Skip to content

Commit 8009853

Browse files
Copilothotlong
andcommitted
Fix MetadataCache test timing issue
Increase wait time from 100ms to 110ms in the second timeout to ensure the total elapsed time exceeds the 200ms TTL, accounting for JavaScript timer precision variability. Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent b990144 commit 8009853

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

packages/data-objectstack/src/cache/MetadataCache.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ describe('MetadataCache', () => {
101101
await new Promise(resolve => setTimeout(resolve, 100));
102102
await cache.get('test', fetcher);
103103

104-
// Access again after another 100ms (total 200ms from first, but 100ms from last access)
105-
await new Promise(resolve => setTimeout(resolve, 100));
104+
// Access again after another 110ms (total 210ms from first, ensuring TTL has passed)
105+
await new Promise(resolve => setTimeout(resolve, 110));
106106

107107
// Should still be in cache because we're checking timestamp, not last accessed
108108
// Actually, the implementation uses timestamp for expiration, not lastAccessed
109-
// So after 200ms total, it should expire
109+
// So after 210ms total (> 200ms TTL), it should expire
110110
await cache.get('test', fetcher);
111111

112112
// Should have been called twice - initial + after expiration

0 commit comments

Comments
 (0)