Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
29 changes: 22 additions & 7 deletions crates/durable-test/tests/it/dst_notify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,28 @@ async fn dst_notify_timeout_records_scheduler_events(pool: sqlx::PgPool) -> anyh
);

// TaskCompleted should have fired exactly once.
let complete_count = scheduler
.events()
.iter()
.filter(|e| {
matches!(e, durable_runtime::scheduler::ScheduleEvent::TaskCompleted { task_id, .. } if *task_id == task.id())
})
.count();
//
// There is a small window between when the worker commits the task's
// "complete" state to the database (which causes `task.wait()` to return)
// and when it calls `scheduler.notify(TaskCompleted)`. On a multi-threaded
// runtime we may need to yield briefly to let the worker finish.
let complete_count = timeout(Duration::from_secs(5), async {
loop {
let count = scheduler
.events()
.iter()
.filter(|e| {
matches!(e, durable_runtime::scheduler::ScheduleEvent::TaskCompleted { task_id, .. } if *task_id == task.id())
})
.count();
if count > 0 {
break count;
}
tokio::task::yield_now().await;
}
})
.await
.context("TaskCompleted event not recorded within 5s")?;
assert_eq!(
complete_count, 1,
"expected exactly 1 TaskCompleted event, got {complete_count}"
Expand Down
5 changes: 2 additions & 3 deletions crates/xtask/src/claude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,15 @@ impl Setup {
tracing::info!("configuring trust authentication in {hba_path}");

// Replace all auth methods with trust for local and host connections.
let new_contents = format!(
"\
let new_contents = "\
# durable-xtask: trust auth configured
# This file was modified by `cargo xtask claude setup` to allow passwordless
# local development connections.
local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
"
);
.to_string();

std::fs::write(&hba_path, new_contents)
.with_context(|| format!("failed to write {hba_path}"))?;
Expand Down
Loading