Skip to content

Commit f109509

Browse files
committed
removed fetching and queuing
1 parent 6eabbe1 commit f109509

File tree

1 file changed

+6
-27
lines changed

1 file changed

+6
-27
lines changed

src/scripts/scrumHelper.js

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ let githubCache = {
1010
cacheKey: null,
1111
timestamp: null,
1212
ttl: null,
13-
fetching: false,
14-
queue: [],
1513
subject: null
1614
};
1715

@@ -359,8 +357,9 @@ function allIncluded(outputTarget = 'email') {
359357
async function fetchGithubData() {
360358
const cacheKey = `${githubUsername}-${orgName}-${startingDate}-${endingDate}`;
361359

362-
if (githubCache.fetching || (githubCache.cacheKey === cacheKey && githubCache.data)) {
363-
log('Fetch already in progress or data already fetched. Skipping fetch.');
360+
// Remove fetching/queue logic: always run fetch
361+
if (githubCache.cacheKey === cacheKey && githubCache.data) {
362+
log('Data already fetched for this cacheKey. Skipping fetch.');
364363
return;
365364
}
366365

@@ -375,7 +374,7 @@ function allIncluded(outputTarget = 'email') {
375374
log('Has data:', !!githubCache.data);
376375

377376
// Check if we need to load from storage
378-
if (!githubCache.data && !githubCache.fetching) {
377+
if (!githubCache.data) {
379378
await loadFromStorage();
380379
};
381380

@@ -400,15 +399,7 @@ function allIncluded(outputTarget = 'email') {
400399
log('Cache is stale - fetching new data');
401400
}
402401

403-
// if fetching is in progress, queue the calls and return a promise resolved when done
404-
if (githubCache.fetching) {
405-
log('Fetch in progress, queuing requests');
406-
return new Promise((resolve, reject) => {
407-
githubCache.queue.push({ resolve, reject });
408-
});
409-
}
410-
411-
githubCache.fetching = true;
402+
// Remove fetching/queue logic: always run fetch
412403
githubCache.cacheKey = cacheKey;
413404

414405
const headers = {
@@ -468,17 +459,8 @@ function allIncluded(outputTarget = 'email') {
468459
if (outputTarget === 'popup') {
469460
resetReportState(true, 'popup');
470461
}
471-
472-
// Resolve queued calls
473-
githubCache.queue.forEach(({ resolve }) => resolve());
474-
githubCache.queue = [];
475462
} catch (err) {
476463
logError('Fetch Failed:', err);
477-
// Reject queued calls on error
478-
githubCache.queue.forEach(({ reject }) => reject(err));
479-
githubCache.queue = [];
480-
githubCache.fetching = false;
481-
482464
if (outputTarget === 'popup') {
483465
const generateBtn = document.getElementById('generateReport');
484466
if (generateBtn) {
@@ -487,8 +469,6 @@ function allIncluded(outputTarget = 'email') {
487469
}
488470
}
489471
throw err;
490-
} finally {
491-
githubCache.fetching = false;
492472
}
493473
}
494474

@@ -497,8 +477,7 @@ function allIncluded(outputTarget = 'email') {
497477
hasCachedData: !!githubCache.data,
498478
cacheAge: githubCache.timestamp ? `${((Date.now() - githubCache.timestamp) / 1000 / 60).toFixed(1)} minutes` : `no cache`,
499479
cacheKey: githubCache.cacheKey,
500-
isFetching: githubCache.fetching,
501-
queueLength: githubCache.queue.length
480+
isFetching: false,
502481
});
503482
const storageData = await new Promise(resolve => {
504483
chrome.storage.local.get('githubCache', resolve);

0 commit comments

Comments
 (0)