Skip to content

Commit 3f38dc3

Browse files
committed
fix: PR corrections round 3
Refs: #121.
1 parent 80881ba commit 3f38dc3

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
uses: actions/checkout@v4
6363

6464
- name: Setup Rust
65-
uses: dtolnay/rust-toolchain@1.92.0
65+
uses: dtolnay/rust-toolchain@1.94.0
6666

6767
- name: Setup Clippy
6868
run: rustup component add clippy

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ once_cell = "1.21.3"
4343
csv = "1.4.0"
4444
mkenv = "1.0.2"
4545
nom = "8.0.0"
46-
pin-project-lite = "0.2.16"
46+
pin-project-lite = "0.2.17"
4747
sea-orm = { version = "1.1.19", features = [
4848
"runtime-tokio",
4949
"macros",

crates/game_api/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ once_cell = { workspace = true }
3434
records-lib = { path = "../records_lib", features = ["tracing"] }
3535
mkenv = { workspace = true }
3636
nom = { workspace = true }
37-
pin-project-lite = { version = "0.2.17" }
37+
pin-project-lite = { workspace = true }
3838
request_filter = { path = "../request_filter", optional = true }
3939
dsc_webhook = { path = "../dsc_webhook", features = ["actix-web"] }
4040
sea-orm = { workspace = true }

crates/game_api/src/configure/slow_req_mw.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,13 @@ impl TimeoutHandler for WebhookTimeoutHandler {
5454
let client = self.0.clone();
5555

5656
tokio::task::spawn(async move {
57-
if let Err(e) = client.post(wh_url).json(&wh_msg).send().await {
57+
if let Err(e) = client
58+
.post(wh_url)
59+
.json(&wh_msg)
60+
.send()
61+
.await
62+
.and_then(|e| e.error_for_status())
63+
{
5864
tracing::error!("couldn't send timeout error to webhook: {e}. body:\n{wh_msg:#?}");
5965
}
6066
});
@@ -216,17 +222,19 @@ where
216222
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
217223
let this = self.project();
218224

219-
if let Poll::Ready(res) = this.inner_fut.poll(cx) {
220-
return Poll::Ready(res);
221-
}
222-
225+
// To ensure catching the timeout (in case the async runtime is laggy),
226+
// we poll the timer first.
223227
if !*this.is_handled
224228
&& let Poll::Ready(_) = this.sleep_fut.poll(cx)
225229
{
226230
this.handler.on_timeout(this.info);
227231
*this.is_handled = true;
228232
}
229233

234+
if let Poll::Ready(res) = this.inner_fut.poll(cx) {
235+
return Poll::Ready(res);
236+
}
237+
230238
Poll::Pending
231239
}
232240
}

0 commit comments

Comments
 (0)