mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-22 06:41:46 +00:00
fix: prevent IDB write-stall from blocking trip page and sync loop
clearAll() now clears all tables in a transaction instead of calling offlineDb.delete(), which triggered our versionchange handler and put Dexie into a broken write state for the rest of the session. tripRepo.get() gets the same 2 s timeout guard as list() so a stalled IDB read no longer freezes the trip splash screen. _doSync wraps each syncTrip() in a 30 s per-trip timeout so a single stalled write transaction cannot prevent the loop from advancing to subsequent trips.
This commit is contained in:
@@ -48,7 +48,10 @@ export const tripRepo = {
|
||||
},
|
||||
|
||||
async get(tripId: number | string): Promise<{ trip: Trip; refresh: TripRefresh }> {
|
||||
const cached = await offlineDb.trips.get(Number(tripId))
|
||||
const cached = await Promise.race([
|
||||
offlineDb.trips.get(Number(tripId)).catch(() => undefined),
|
||||
new Promise<undefined>(resolve => setTimeout(() => resolve(undefined), 2000)),
|
||||
])
|
||||
|
||||
const refresh: TripRefresh = (async () => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user