mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-23 07:26:30 +00:00
f5339307b2
Every open tab shares the account's queue and runs its own flush triggers, and the _flushing flag only guards its own tab. Two tabs read the same pending rows and both replayed them, so correctness rested on the server's replay cache answering the second request, and each tab ran the temp id remap and the Dexie write a second time. The flush now takes a Web Lock named after the account's database, with ifAvailable, so a tab that finds it taken skips the run the way a busy flush in the same tab always has; the holder picks the rows up. The lock is released with the tab, so a tab killed mid-flush cannot strand it. Where the API is missing or refuses the request, the flush runs as before under the flag alone.