Skip to content

Commit a0d58a1

Browse files
committed
chore(runner): decrease timeout to 15s
1 parent 7895f28 commit a0d58a1

File tree

2 files changed

+10
-5
lines changed
  • engine

2 files changed

+10
-5
lines changed

engine/packages/pegboard/src/workflows/runner.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ use crate::{keys, workflows::actor::Allocate};
1515
pub const RUNNER_ELIGIBLE_THRESHOLD_MS: i64 = util::duration::seconds(10);
1616
/// How long to wait after last ping before forcibly removing a runner from the database and deleting its
1717
/// workflow, evicting all actors. Note that the runner may still be running and can reconnect.
18-
const RUNNER_LOST_THRESHOLD_MS: i64 = util::duration::minutes(2);
18+
///
19+
/// Runner ping interval is currently set to 3s.
20+
const RUNNER_LOST_THRESHOLD_MS: i64 = util::duration::seconds(15);
1921
/// Batch size of how many events to ack.
2022
const EVENT_ACK_BATCH_SIZE: i64 = 500;
2123

engine/sdks/typescript/runner/src/mod.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import type { WebSocketTunnelAdapter } from "./websocket-tunnel-adapter";
99

1010
const KV_EXPIRE: number = 30_000;
1111
const PROTOCOL_VERSION: number = 2;
12+
const RUNNER_PING_INTERVAL = 3_000;
1213

1314
/** Warn once the backlog significantly exceeds the server's ack batch size. */
1415
const EVENT_BACKLOG_WARN_THRESHOLD = 10_000;
@@ -64,7 +65,11 @@ export interface RunnerConfig {
6465
config: ActorConfig,
6566
) => Promise<void>;
6667
onActorStop: (actorId: string, generation: number) => Promise<void>;
67-
getActorHibernationConfig: (actorId: string, requestId: ArrayBuffer, request: Request) => HibernationConfig;
68+
getActorHibernationConfig: (
69+
actorId: string,
70+
requestId: ArrayBuffer,
71+
request: Request,
72+
) => HibernationConfig;
6873
noAutoShutdown?: boolean;
6974
}
7075

@@ -250,7 +255,6 @@ export class Runner {
250255

251256
this.#actors.delete(actorId);
252257

253-
254258
return actor;
255259
}
256260

@@ -510,7 +514,6 @@ export class Runner {
510514
this.#processUnsentKvRequests();
511515

512516
// Start ping interval
513-
const pingInterval = 1000;
514517
const pingLoop = setInterval(() => {
515518
if (ws.readyState === 1) {
516519
this.__sendToServer({
@@ -526,7 +529,7 @@ export class Runner {
526529
runnerId: this.runnerId,
527530
});
528531
}
529-
}, pingInterval);
532+
}, RUNNER_PING_INTERVAL);
530533
this.#pingLoop = pingLoop;
531534

532535
// Start command acknowledgment interval (5 minutes)

0 commit comments

Comments
 (0)