Announce sweeper: refresh open records from content
A date or place corrected after first announce never reached the portal_events record, so the followup fired on the stale schedule. While a record is still in its initial state, content is the source of truth: differing responses are written back on each sweep. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y42TyF8Zu7NGRR2893vNcZ
This commit is contained in:
co-authored by
Claude Fable 5
parent
3de069f41d
commit
8229dbf4c2
@@ -92,6 +92,18 @@ pub async fn sweep(state: &AppState) -> anyhow::Result<()> {
|
|||||||
Some(a) => a,
|
Some(a) => a,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Content is the source of truth while the window is still
|
||||||
|
// open: a corrected date or place flows into the record, so the
|
||||||
|
// followup fires on the schedule the page actually announces.
|
||||||
|
if answer.state == schema.initial && answer.responses != responses {
|
||||||
|
let mut refreshed = answer.clone();
|
||||||
|
refreshed.responses = responses.clone();
|
||||||
|
if let Some(store) = &store {
|
||||||
|
store.put(&id, serde_json::to_vec(&refreshed)?.into()).await?;
|
||||||
|
tracing::info!(question = %q.id, "event record refreshed from content");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if answer.state == schema.initial && now_ms >= ends {
|
if answer.state == schema.initial && now_ms >= ends {
|
||||||
let target = "awaiting_summary";
|
let target = "awaiting_summary";
|
||||||
let payload = serde_json::json!({ "to": target, "item": id, "by": "portal" });
|
let payload = serde_json::json!({ "to": target, "item": id, "by": "portal" });
|
||||||
|
|||||||
Reference in New Issue
Block a user