Implement authorized live event replay
This commit is contained in:
parent
4c93c25692
commit
06a7ac56b7
1 changed files with 2370 additions and 364 deletions
|
|
@ -668,6 +668,8 @@ impl AttemptService {
|
|||
.retry_not_before
|
||||
.is_some_and(|due| due <= OffsetDateTime::now_utc())
|
||||
{
|
||||
let mut tx = self.pool.begin().await?;
|
||||
let now = OffsetDateTime::now_utc();
|
||||
let changed = sqlx::query(
|
||||
"UPDATE jobs SET phase = 'queued', dispatch_needed = TRUE,
|
||||
retry_not_before = NULL, revision = revision + 1, updated_at = $2
|
||||
|
|
@ -675,14 +677,16 @@ impl AttemptService {
|
|||
AND retry_not_before <= $2",
|
||||
)
|
||||
.bind(job_id.as_str())
|
||||
.bind(OffsetDateTime::now_utc())
|
||||
.execute(&self.pool)
|
||||
.bind(now)
|
||||
.execute(tx.as_mut())
|
||||
.await?;
|
||||
if changed.rows_affected() == 1 {
|
||||
enqueue(&mut tx, "job.updated", json!({ "job_id": job_id })).await?;
|
||||
report.retries_scheduled += 1;
|
||||
row.phase = "queued".into();
|
||||
row.dispatch_needed = true;
|
||||
}
|
||||
tx.commit().await?;
|
||||
}
|
||||
}
|
||||
if row.phase == "queued"
|
||||
|
|
@ -1222,6 +1226,7 @@ async fn reap_lost_attempt(
|
|||
.execute(tx.as_mut())
|
||||
.await?;
|
||||
enqueue(tx, "job.retry_wait", json!({ "job_id": job_id })).await?;
|
||||
enqueue(tx, "job.updated", json!({ "job_id": job_id })).await?;
|
||||
} else {
|
||||
sqlx::query(
|
||||
"UPDATE jobs SET phase = 'failed', authority_attempt_id = NULL,
|
||||
|
|
|
|||
Loading…
Reference in a new issue