rocicorp / replicache

Realtime Sync for Any Backend Stack
https://doc.replicache.dev
1.05k stars 37 forks source link

feat: Simplified Dueling Dags - Mutation Recovery - Make recovery robust to errors and exit early on close. #820

Closed grgbkr closed 2 years ago

grgbkr commented 2 years ago

Problem If the Mutation Recovery process stops on the first error encountered. This means a single problematic db or client can prevent recovery of all other clients.

Solution Updates Mutation Recovery logic to be more robust against errors. If an error occurs recovering a particular client or db, the logic will now log that error, and continue trying to recover other clients/dbs.

Adding the above robustness requires the process to handle the Replicache instance being closed more explicitly. Previously the process would stop on the first error encountered due to the Replicache intance being closed. This change updates the logic to check if this Replicache instance is closed before processing each db, and each client inside each db, and exits early if this Replicache instance is closed.

vercel[bot] commented 2 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/rocicorp/replicache/2wWLrajbtM23pfAMHNAYE5jDBx8Y
✅ Preview: https://replicache-git-grgbkr-sdd-mutation-recovery-robust-rocicorp.vercel.app