forge_notify: check mark-read HTTP status, warn on non-2xx
This commit is contained in:
parent
ddd0248619
commit
a13f63f30c
1 changed files with 10 additions and 2 deletions
|
|
@ -267,13 +267,21 @@ async fn poll_once(client: &reqwest::Client, forge_url: &str, token: &str, socke
|
|||
// Mark as read only after successful delivery so a failed-delivery
|
||||
// notification resurfaces on the next poll tick.
|
||||
let mark_url = format!("{forge_url}/api/v1/notifications/threads/{id}");
|
||||
if let Err(e) = client
|
||||
match client
|
||||
.patch(&mark_url)
|
||||
.header("Authorization", format!("token {token}"))
|
||||
.send()
|
||||
.await
|
||||
{
|
||||
debug!(%id, error = ?e, "forge_notify: mark-read failed (non-fatal)");
|
||||
Err(e) => {
|
||||
warn!(%id, error = ?e, "forge_notify: mark-read request failed — notification will resurface");
|
||||
}
|
||||
Ok(r) if !r.status().is_success() => {
|
||||
warn!(%id, status = %r.status(), "forge_notify: mark-read returned non-2xx — notification will resurface");
|
||||
}
|
||||
Ok(_) => {
|
||||
debug!(%id, "forge_notify: marked read");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue