Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added batching using DB. #731

Merged
merged 4 commits into from
May 28, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix tree state initialization race condition.
  • Loading branch information
piohei committed May 27, 2024
commit f60fe06841cdd2edb04af5ad9cc0d1a42f90d90d
9 changes: 6 additions & 3 deletions src/task_monitor/tasks/process_batches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ pub async fn process_batches(
tracing::info!("Awaiting for a clean slate");
app.identity_manager.await_clean_slate().await?;

// This is a tricky way to know that we are not changing data during tree
// initialization process.
_ = app.tree_state()?;
tracing::info!("Starting identity processor.");

// We start a timer and force it to perform one initial tick to avoid an
Expand All @@ -33,15 +36,15 @@ pub async fn process_batches(
// We wait either for a timer tick or a full batch
select! {
_ = timer.tick() => {
tracing::info!("Identity batch insertion woken due to timeout");
tracing::info!("Identity processor woken due to timeout");
}

() = next_batch_notify.notified() => {
tracing::trace!("Identity batch insertion woken due to next batch creation");
tracing::trace!("Identity processor woken due to next batch creation");
},

() = wake_up_notify.notified() => {
tracing::trace!("Identity batch insertion woken due to request");
tracing::trace!("Identity processor woken due to request");
},
}

Expand Down