Skip to content

Commit 52078ee

Browse files
committed
Address bryancall's review comments
Fix sync retry logic: revert last_sync to its previous value on syncMap failure instead of setting it to last_write. The old code made the slot appear clean, preventing retries until a new Insert bumped last_write again.
1 parent 94cbf01 commit 52078ee

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

doc/developer-guide/cripts/cripts-misc.en.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,8 @@ Debug logging uses the same format string syntax as ``fmt::format()`` in ``libfm
415415
The default debug tag for Cripts is the name of the Cript itself, either
416416
the Cript source file, or the compiled plugin name.
417417

418+
.. _cripts-misc-cache-groups:
419+
418420
Cache Groups
419421
============
420422

src/cripts/CacheGroup.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,12 +292,13 @@ Cache::Group::WriteToDisk()
292292

293293
for (size_t ix = 0; ix < _slots.size(); ++ix) {
294294
if (_slots[ix].last_write > _slots[ix].last_sync) {
295+
auto old_sync = _slots[ix].last_sync;
295296
any_dirty = true;
296297
_slots[ix].last_sync = now;
297298
if (syncMap(ix)) {
298299
_last_sync = now;
299300
} else {
300-
_slots[ix].last_sync = _slots[ix].last_write; // revert so next call retries
301+
_slots[ix].last_sync = old_sync; // revert so next call retries
301302
all_synced = false;
302303
}
303304
}

0 commit comments

Comments
 (0)