MCPcopy Create free account
hub / github.com/Snapchat/Valdi / scheduleSave

Method scheduleSave

valdi/src/valdi/runtime/JavaScript/Modules/PersistentStore.cpp:149–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149void PersistentStore::scheduleSave(Function<void(Result<Void>)> completion) {
150 auto wasEmpty = _pendingSaves.empty();
151 _pendingSaves.emplace_back(std::move(completion));
152 if (wasEmpty) {
153 if (_disableBatchWrites) {
154 doSave();
155 } else {
156 _dispatchQueue->asyncAfter([self = strongRef(this)]() { self->doSave(); },
157 std::chrono::milliseconds(kPersistentStoreSaveDelayMs));
158 }
159 }
160}
161
162void PersistentStore::doSave() {
163 Result<Void> result;

Callers 3

storeMethod · 0.95
removeMethod · 0.95
removeAllMethod · 0.95

Calls 4

doSaveMethod · 0.95
strongRefFunction · 0.85
emptyMethod · 0.45
asyncAfterMethod · 0.45

Tested by

no test coverage detected