Skip to content

Commit

Permalink
Log when deleteAll is called with an alarm still set on the object
Browse files Browse the repository at this point in the history
To get a better sense of the prevalence of this usage pattern.
  • Loading branch information
a-robinson committed Aug 30, 2024
1 parent f067058 commit 2f13452
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/workerd/api/actor-state.c++
Original file line number Diff line number Diff line change
Expand Up @@ -509,9 +509,24 @@ jsg::Promise<void> DurableObjectStorage::deleteAll(
jsg::Lock& js, jsg::Optional<PutOptions> maybeOptions) {
auto options = configureOptions(kj::mv(maybeOptions).orDefault(PutOptions{}));

auto& context = IoContext::current();
{
// Log to get a sense of whether users are potentially depending on alarms being kept around
// after deleteAll is called.
auto getOptions = configureOptions(GetOptions{});
context.addTask(context
.awaitJs(js,
transformCacheResult(js, cache->getAlarm(getOptions), getOptions,
[](jsg::Lock&, kj::Maybe<kj::Date> alarmValue) {
if (alarmValue != kj::none) {
LOG_WARNING_PERIODICALLY("NOSENTRY deleteAll called with an alarm still set");
}
return alarmValue;
})).ignoreResult());
}

auto deleteAll = cache->deleteAll(options);

auto& context = IoContext::current();
context.addTask(updateStorageDeletes(context, currentActorMetrics(), kj::mv(deleteAll.count)));

return transformMaybeBackpressure(js, options, kj::mv(deleteAll.backpressure));
Expand Down

0 comments on commit 2f13452

Please sign in to comment.