Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion engine/packages/pegboard/src/workflows/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ use crate::{keys, workflows::actor::Allocate};
pub const RUNNER_ELIGIBLE_THRESHOLD_MS: i64 = util::duration::seconds(10);
/// How long to wait after last ping before forcibly removing a runner from the database and deleting its
/// workflow, evicting all actors. Note that the runner may still be running and can reconnect.
const RUNNER_LOST_THRESHOLD_MS: i64 = util::duration::minutes(2);
///
/// Runner ping interval is currently set to 3s.
const RUNNER_LOST_THRESHOLD_MS: i64 = util::duration::seconds(15);
/// Batch size of how many events to ack.
const EVENT_ACK_BATCH_SIZE: i64 = 500;

Expand Down
11 changes: 7 additions & 4 deletions engine/sdks/typescript/runner/src/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type { WebSocketTunnelAdapter } from "./websocket-tunnel-adapter";

const KV_EXPIRE: number = 30_000;
const PROTOCOL_VERSION: number = 2;
const RUNNER_PING_INTERVAL = 3_000;

/** Warn once the backlog significantly exceeds the server's ack batch size. */
const EVENT_BACKLOG_WARN_THRESHOLD = 10_000;
Expand Down Expand Up @@ -64,7 +65,11 @@ export interface RunnerConfig {
config: ActorConfig,
) => Promise<void>;
onActorStop: (actorId: string, generation: number) => Promise<void>;
getActorHibernationConfig: (actorId: string, requestId: ArrayBuffer, request: Request) => HibernationConfig;
getActorHibernationConfig: (
actorId: string,
requestId: ArrayBuffer,
request: Request,
) => HibernationConfig;
noAutoShutdown?: boolean;
}

Expand Down Expand Up @@ -250,7 +255,6 @@ export class Runner {

this.#actors.delete(actorId);


return actor;
}

Expand Down Expand Up @@ -510,7 +514,6 @@ export class Runner {
this.#processUnsentKvRequests();

// Start ping interval
const pingInterval = 1000;
const pingLoop = setInterval(() => {
if (ws.readyState === 1) {
this.__sendToServer({
Expand All @@ -526,7 +529,7 @@ export class Runner {
runnerId: this.runnerId,
});
}
}, pingInterval);
}, RUNNER_PING_INTERVAL);
this.#pingLoop = pingLoop;

// Start command acknowledgment interval (5 minutes)
Expand Down
Loading