Skip to content

Commit 6d62cb9

Browse files
leshniakclaude
andcommitted
fix: move probe healthy log to req.onsuccess to avoid false positive
The "connection is healthy" log was emitted synchronously after count(), before the IDB request completed. If the request later failed via onerror, both healthy and stale logs would fire for the same visibility event. Now only logs on actual success. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2110435 commit 6d62cb9

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

lib/storage/providers/IDBKeyValProvider/createStore.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,12 @@ function createStore(dbName: string, storeName: string): UseStore {
164164
const tx = db.transaction(storeName, 'readonly');
165165
const probeStore = tx.objectStore(storeName);
166166
const req = probeStore.count();
167+
req.onsuccess = () => {
168+
Logger.logInfo('IDB visibilitychange probe: connection is healthy', {dbName, storeName});
169+
};
167170
req.onerror = () => {
168171
dropCacheIfStale(req.error);
169172
};
170-
Logger.logInfo('IDB visibilitychange probe: connection is healthy', {dbName, storeName});
171173
} catch (error) {
172174
dropCacheIfStale(error);
173175
}

0 commit comments

Comments
 (0)