Commit 6a982db
authored
only persist documents to S3 when dirty (#416)
Fix an issue where y-sweet was persisting documents to S3 every ~10
seconds even when no changes had occurred.
From what I understand, the persistence worker wakes up both on the
dirty signal and also on a `checkpoint_freq` interval and was always
calling persist, regardless of the dirtiness, which would write it to S3
regardless of whether any changes had been made.
The fix adds a check to only persist when the document is actually
dirty.
I'm still a little bit unclear behind the reasoning for the logic of
signaling the worker both on a dirty callback and on a timer.
So I wonder if we instead just start the worker once, wake every 10
seconds, check if dirty, persist if needed.1 parent e492348 commit 6a982db
1 file changed
+35
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
59 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
60 | 70 | | |
61 | 71 | | |
62 | 72 | | |
| |||
299 | 309 | | |
300 | 310 | | |
301 | 311 | | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
302 | 337 | | |
0 commit comments