Skip to content

Commit

Permalink
[lib] Set failedQueryCacheTimeout to 0 in UserIdentityCache
Browse files Browse the repository at this point in the history
Summary: This addresses [ENG-9255](https://linear.app/comm/issue/ENG-9255/reduce-failedquerycachetimeout-in-useridentitycache), and makes it so if a user identity fetch times out, the next time it's requested, we don't return `null` from the cache, but instead retry the fetch.

Test Plan: I set `queryTimeout` to 1 second, which made it time out. I confirmed in the logs that after the timeout, a second request was dispatched

Reviewers: varun, will

Reviewed By: varun

Subscribers: tomek

Differential Revision: https://phab.comm.dev/D13299
  • Loading branch information
Ashoat committed Sep 12, 2024
1 parent 5dd8a28 commit 5aeb8c7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/components/user-identity-cache.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import type {
import sleep from '../utils/sleep.js';

const cacheTimeout = 24 * 60 * 60 * 1000; // one day
const failedQueryCacheTimeout = 5 * 60 * 1000; // five minutes
// If the query fails due to a timeout, we don't cache it
// This forces a retry on the next request
const failedQueryCacheTimeout = 0;
const queryTimeout = 20 * 1000; // twenty seconds

async function throwOnTimeout(identifier: string) {
Expand Down Expand Up @@ -172,7 +174,7 @@ function UserIdentityCacheProvider(props: Props): React.Node {
});
continue;
}
resultMap.set(userID, null);
resultMap.set(userID, undefined);
}
return resultMap;
})();
Expand Down

0 comments on commit 5aeb8c7

Please sign in to comment.