Skip to content

Commit f42ac29

Browse files
committed
Fixes avatar "never expire" timestamp being smaller than Date.now()
The V8 smi optimization (2^30) was applied to the avatar cache timestamp in 2975af4, replacing Number.MAX_SAFE_INTEGER. Unlike the annotation providers where the value is compared against line/column numbers, here it is compared against Date.now() (~1.75 trillion ms), so the "never expire" sentinel (~1.07 billion) always appears expired. This caused repeated async re-lookups for repos with remotes but no integration. Uses Infinity as the sentinel — makes hasAvatarExpired return false without any arithmetic, and communicates the "never expire" intent directly. (#5155)
1 parent 7c9894c commit f42ac29

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

src/avatars.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ import { configuration } from './system/-webview/configuration.js';
2020
import { getContext } from './system/-webview/context.js';
2121
import type { ContactPresenceStatus } from './vsls/vsls.js';
2222

23-
const maxSmallIntegerV8 = 2 ** 30 - 1; // Max number that can be stored in V8's smis (small integers)
24-
2523
let avatarCache: Map<string, Avatar> | undefined;
2624
const avatarQueue = new Map<string, Promise<Uri>>();
2725

@@ -270,7 +268,7 @@ async function getAvatarUriFromRemoteProvider(
270268
if (account?.avatarUrl == null) {
271269
// If we have no account assume that won't change (without a reset), so set the timestamp to "never expire"
272270
avatar.uri = undefined;
273-
avatar.timestamp = maxSmallIntegerV8;
271+
avatar.timestamp = Infinity;
274272
avatar.retries = 0;
275273

276274
return undefined;

0 commit comments

Comments
 (0)