Skip to content

Commit 5ce2a27

Browse files
authored
Merge pull request #8 from cloudflare/lvalenta/batcher-alarm
Do not reschedule Batcher alarm when there are no pending entries
2 parents 156ffe6 + 7bf821f commit 5ce2a27

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

crates/ct_worker/src/batcher_do.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,10 @@ impl DurableObject for Batcher {
145145
}
146146

147147
async fn alarm(&mut self) -> Result<Response> {
148-
if !self.initialized {
148+
if !self.initialized || self.batch.pending_leaves.is_empty() {
149149
return Response::empty();
150150
}
151-
if !self.batch.pending_leaves.is_empty()
152-
&& self.last_batch_millis + MAX_BATCH_TIMEOUT_MILLIS < util::now_millis()
153-
{
151+
if self.last_batch_millis + MAX_BATCH_TIMEOUT_MILLIS < util::now_millis() {
154152
if let Err(e) = self.submit_batch().await {
155153
log::warn!("failed to submit batch: {e}");
156154
}

0 commit comments

Comments
 (0)