Skip to content

Commit c8edbf6

Browse files
authored
Merge pull request #180 from vedansh-5/cacheBug
caching bug fixed
2 parents f733da7 + 761c5ed commit c8edbf6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/scripts/scrumHelper.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,13 @@ function allIncluded(outputTarget = 'email') {
266266
cacheKey: githubCache.cacheKey,
267267
timestamp: githubCache.timestamp,
268268
subject: subject,
269+
usedToken: !!githubToken
269270
}
270271
log(`Saving data to storage:`, {
271272
cacheKey: githubCache.cacheKey,
272273
timestamp: githubCache.timestamp,
273274
hasSubject: !!subject,
275+
org: orgName,
274276
});
275277

276278
return new Promise((resolve) => {
@@ -338,6 +340,7 @@ function allIncluded(outputTarget = 'email') {
338340
username: githubUsername,
339341
startDate: startingDate,
340342
endDate: endingDate,
343+
org: orgName,
341344
});
342345

343346
log('CacheKey in cache:', githubCache.cacheKey);
@@ -358,8 +361,8 @@ function allIncluded(outputTarget = 'email') {
358361
const isCacheKeyMatch = githubCache.cacheKey === cacheKey;
359362
const needsToken = !!githubToken;
360363
const cacheUsedToken = !!githubCache.usedToken;
361-
if (githubCache.data && isCacheFresh & isCacheKeyMatch) { //should be && check after rebase
362-
if (needsToken & !cacheUsedToken) {
364+
if (githubCache.data && isCacheFresh && isCacheKeyMatch) {
365+
if (needsToken && !cacheUsedToken) {
363366
log('Cache was fetched without token, but user now has a token. Invalidating cache.');
364367
githubCache.data = null;
365368
} else {
@@ -386,6 +389,7 @@ function allIncluded(outputTarget = 'email') {
386389

387390
githubCache.fetching = true;
388391
githubCache.cacheKey = cacheKey;
392+
githubCache.usedToken = !!githubToken;
389393

390394
const headers = {
391395
'Accept': 'application/vnd.github.v3+json',

0 commit comments

Comments
 (0)