Add longest wait time when fetching from storage in support info

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1865

This may be useful to rule out that the issue is caused by the
browser API responding in unduly delayed manner.
This commit is contained in:
Raymond Hill 2022-01-14 09:07:28 -05:00
parent 9759bfef4e
commit de0f6a2cdd
No known key found for this signature in database
GPG key ID: 25E1490B761470C2
2 changed files with 8 additions and 0 deletions

View file

@ -538,6 +538,7 @@ const saveAssetCacheRegistry = (( ) => {
})();
const assetCacheRead = async function(assetKey, updateReadTime = false) {
const t0 = Date.now();
const internalKey = `cache/${assetKey}`;
const reportBack = function(content) {
@ -551,6 +552,12 @@ const assetCacheRead = async function(assetKey, updateReadTime = false) {
getAssetCacheRegistry(),
cacheStorage.get(internalKey),
]);
µb.supportStats.maxAssetCacheWait = Math.max(
Date.now() - t0,
parseInt(µb.supportStats.maxAssetCacheWait, 10)
) + ' ms';
if (
bin instanceof Object === false ||
bin.hasOwnProperty(internalKey) === false

View file

@ -215,6 +215,7 @@ const µBlock = { // jshint ignore:line
supportStats: {
allReadyAfter: '',
maxAssetCacheWait: '0 ms',
},
pageStores: new Map(),