@@ -215,7 +215,7 @@ void ActorCache::requireNotTerminal() {
215
215
// we don't let the worker return stale state. This isn't strictly necessary but it does
216
216
// mirror previous behavior wherein we would use disabled storage via `flushImpl()` and break
217
217
// the output gate.
218
- ensureFlushScheduled ({});
218
+ ensureFlushScheduled ({}, " requireNotTerminal intentionally breaking output gate " _kjc );
219
219
}
220
220
221
221
kj::throwFatalException (kj::cp (e));
@@ -249,7 +249,7 @@ void ActorCache::evictOrOomIfNeeded(Lock& lock) {
249
249
// that returns a promise which we'd then have to put somewhere so that we don't immediately
250
250
// cancel it. Instead, we can ensure that a flush has been scheduled. `flushImpl()`, when
251
251
// called, will throw an exception which breaks the gate.
252
- ensureFlushScheduled (WriteOptions ());
252
+ ensureFlushScheduled (WriteOptions (), " evictOrOomIfNeeded intentionally breaking output gate " _kjc );
253
253
}
254
254
255
255
kj::throwFatalException (kj::mv (exception ));
@@ -1853,7 +1853,7 @@ kj::Maybe<kj::Promise<void>> ActorCache::setAlarm(kj::Maybe<kj::Date> newAlarmTi
1853
1853
options.noCache
1854
1854
};
1855
1855
1856
- ensureFlushScheduled (options);
1856
+ ensureFlushScheduled (options, " setAlarm flush " _kjc );
1857
1857
1858
1858
return getBackpressure ();
1859
1859
}
@@ -1990,7 +1990,7 @@ ActorCache::DeleteAllResults ActorCache::deleteAll(WriteOptions options) {
1990
1990
.deletedDirty = kj::mv (deletedDirty),
1991
1991
.countFulfiller = kj::mv (paf.fulfiller )
1992
1992
};
1993
- ensureFlushScheduled (options);
1993
+ ensureFlushScheduled (options, " deleteAll flush " _kjc );
1994
1994
} else {
1995
1995
// A previous deleteAll() was scheduled and hasn't been committed yet. This means that we
1996
1996
// can actually coalesce the two, and there's no need to commit any writes that happened
@@ -2108,10 +2108,10 @@ void ActorCache::putImpl(Lock& lock, kj::Own<Entry> newEntry,
2108
2108
addToDirtyList (*slot);
2109
2109
}
2110
2110
2111
- ensureFlushScheduled (options);
2111
+ ensureFlushScheduled (options, " putImpl flush " _kjc );
2112
2112
}
2113
2113
2114
- void ActorCache::ensureFlushScheduled (const WriteOptions& options) {
2114
+ void ActorCache::ensureFlushScheduled (const WriteOptions& options, kj::LiteralStringConst operationInfo ) {
2115
2115
if (lru.options .neverFlush ) {
2116
2116
// Skip all flushes. Used for preview sessions where data is strictly kept in memory.
2117
2117
@@ -2156,19 +2156,19 @@ void ActorCache::ensureFlushScheduled(const WriteOptions& options) {
2156
2156
if (options.allowUnconfirmed ) {
2157
2157
// Don't apply output gate. But, if an exception is thrown, we still want to break the gate,
2158
2158
// so arrange for that.
2159
- flushPromise = flushPromise.catch_ ([this ](kj::Exception&& e) {
2160
- return gate.lockWhile (kj::Promise<void >(kj::mv (e)));
2159
+ flushPromise = flushPromise.catch_ ([this , opInfo = kj::mv (operationInfo) ](kj::Exception&& e) {
2160
+ return gate.lockWhile (kj::Promise<void >(kj::mv (e)), kj::mv (opInfo) );
2161
2161
});
2162
2162
} else {
2163
- flushPromise = gate.lockWhile (kj::mv (flushPromise));
2163
+ flushPromise = gate.lockWhile (kj::mv (flushPromise), kj::mv (operationInfo) );
2164
2164
flushScheduledWithOutputGate = true ;
2165
2165
}
2166
2166
2167
2167
lastFlush = flushPromise.fork ();
2168
2168
} else if (!flushScheduledWithOutputGate && !options.allowUnconfirmed ) {
2169
2169
// The flush has already been scheduled without the output gate, but we want to upgrade it to
2170
2170
// use the output gate now.
2171
- lastFlush = gate.lockWhile (lastFlush.addBranch ()).fork ();
2171
+ lastFlush = gate.lockWhile (lastFlush.addBranch (), kj::mv (operationInfo) ).fork ();
2172
2172
flushScheduledWithOutputGate = true ;
2173
2173
}
2174
2174
}
0 commit comments