Skip to content

Commit a9ac3d3

Browse files
Revert "Merge pull request #359 from topcoder-platform/revert-355-plat-1703-tg-submit-url-issue"
This reverts commit fd71be9, reversing changes made to fa3e79f.
1 parent fd71be9 commit a9ac3d3

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

src/services/groups.js

+19-13
Original file line numberDiff line numberDiff line change
@@ -320,26 +320,32 @@ class GroupService {
320320
* @return {Promise} Resolves to ID array.
321321
*/
322322
async getGroupTreeIds(rootGroupId, maxage = 5 * 60 * 1000) {
323-
const now = Date.now();
324-
const cache = this.private.cache.groupTreeIds;
323+
//TODO: Once the fix is validated and working, remove all commented code related to caching
324+
/**
325+
* Removing the caching mechanism,
326+
* as the group created on the day will only be pickedup on the next day
327+
* and stored in the cache
328+
*/
329+
// const now = Date.now();
330+
// const cache = this.private.cache.groupTreeIds;
325331

326332
/* Clean-up: removes stale records from the cache. */
327-
const CLEAN_UP_INTERVAL = 24 * 60 * 60 * 1000; // 1 day in ms.
328-
if (now - cache.lastCleanUp > CLEAN_UP_INTERVAL) {
329-
_.forOwn(cache, ({ timestamp }, key) => {
330-
if (now - timestamp > CLEAN_UP_INTERVAL) delete cache[key];
331-
});
332-
cache.lastCleanUp = now;
333-
}
333+
// const CLEAN_UP_INTERVAL = 24 * 60 * 60 * 1000; // 1 day in ms.
334+
// if (now - cache.lastCleanUp > CLEAN_UP_INTERVAL) {
335+
// _.forOwn(cache, ({ timestamp }, key) => {
336+
// if (now - timestamp > CLEAN_UP_INTERVAL) delete cache[key];
337+
// });
338+
// cache.lastCleanUp = now;
339+
// }
334340

335341
/* If result is found in cache, and is fresh enough, return it. */
336-
const cached = cache[rootGroupId];
337-
if (cached && now - cached.timestamp < maxage) return _.clone(cached.data);
342+
// const cached = cache[rootGroupId];
343+
// if (cached && now - cached.timestamp < maxage) return _.clone(cached.data);
338344

339345
/* Otherwise, fetch result from the API, write it to the cache, and
340346
* finally return that. */
341347
const res = reduceGroupIds(await this.getGroup(rootGroupId));
342-
cache[rootGroupId] = { data: res, timestamp: now };
348+
// cache[rootGroupId] = { data: res, timestamp: now };
343349
return _.clone(res);
344350
}
345351

@@ -409,4 +415,4 @@ export function getService(tokenV3) {
409415
return lastInstance;
410416
}
411417

412-
export default undefined;
418+
export default undefined;

0 commit comments

Comments
 (0)