Skip to content
Draft
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
2 changes: 1 addition & 1 deletion engine/packages/api-peer/src/actors/kv_get.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::*;
use base64::prelude::BASE64_STANDARD;
use base64::Engine;
use base64::prelude::BASE64_STANDARD;
use pegboard_actor_kv as actor_kv;
use rivet_api_builder::ApiCtx;
use rivet_util::Id;
Expand Down
6 changes: 5 additions & 1 deletion engine/packages/api-public/src/actors/kv_get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ async fn kv_get_inner(ctx: ApiCtx, path: KvGetPath) -> Result<Response> {
request_remote_datacenter_raw(
&ctx,
path.actor_id.label(),
&format!("/actors/{}/kv/keys/{}", path.actor_id, urlencoding::encode(&path.key)),
&format!(
"/actors/{}/kv/keys/{}",
path.actor_id,
urlencoding::encode(&path.key)
),
axum::http::Method::GET,
Option::<&()>::None,
Option::<&()>::None,
Expand Down
4 changes: 2 additions & 2 deletions engine/packages/pegboard-gateway/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,10 +401,10 @@ impl CustomServeTrait for PegboardGateway {
protocol::ToServerTunnelMessageKind::ToServerWebSocketClose(close) => {
tracing::debug!(?close, "server closed websocket");

if can_hibernate && close.retry {
// Successful closure
if can_hibernate && close.hibernate {
return Err(WebSocketServiceHibernate.build());
} else {
// Successful closure
return Ok(LifecycleResult::ServerClose(close));
}
}
Expand Down
2 changes: 1 addition & 1 deletion engine/packages/pegboard-runner/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ impl CustomServeTrait for PegboardRunnerWsCustomServe {
protocol::ToServerWebSocketClose {
code: Some(close_code),
reason: close_reason,
retry: true,
hibernate: true,
},
)
} else {
Expand Down
4 changes: 2 additions & 2 deletions engine/sdks/rust/runner-protocol/src/versioned.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion engine/sdks/schemas/runner-protocol/v3.bare

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 4 additions & 10 deletions engine/sdks/typescript/runner-protocol/src/index.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions engine/sdks/typescript/runner/src/tunnel.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type * as protocol from "@rivetkit/engine-runner-protocol";

Check failure on line 1 in engine/sdks/typescript/runner/src/tunnel.ts

View workflow job for this annotation

GitHub Actions / quality

format

Formatter would have printed the following content:

Check failure on line 1 in engine/sdks/typescript/runner/src/tunnel.ts

View workflow job for this annotation

GitHub Actions / quality

format

Formatter would have printed the following content:
import type { MessageId, RequestId } from "@rivetkit/engine-runner-protocol";
import type { Logger } from "pino";
import { stringify as uuidstringify, v4 as uuidv4 } from "uuid";
import { logger } from "./log";

Check warning on line 5 in engine/sdks/typescript/runner/src/tunnel.ts

View workflow job for this annotation

GitHub Actions / quality

lint/correctness/noUnusedImports

This import is unused.

Check warning on line 5 in engine/sdks/typescript/runner/src/tunnel.ts

View workflow job for this annotation

GitHub Actions / quality

lint/correctness/noUnusedImports

This import is unused.
import type { ActorInstance, Runner } from "./mod";
import {
stringifyToClientTunnelMessageKind,
Expand All @@ -13,7 +13,7 @@

const GC_INTERVAL = 60000; // 60 seconds
const MESSAGE_ACK_TIMEOUT = 5000; // 5 seconds
const WEBSOCKET_STATE_PERSIST_TIMEOUT = 30000; // 30 seconds

Check warning on line 16 in engine/sdks/typescript/runner/src/tunnel.ts

View workflow job for this annotation

GitHub Actions / quality

lint/correctness/noUnusedVariables

This variable WEBSOCKET_STATE_PERSIST_TIMEOUT is unused.

Check warning on line 16 in engine/sdks/typescript/runner/src/tunnel.ts

View workflow job for this annotation

GitHub Actions / quality

lint/correctness/noUnusedVariables

This variable WEBSOCKET_STATE_PERSIST_TIMEOUT is unused.

interface PendingRequest {
resolve: (response: Response) => void;
Expand Down Expand Up @@ -401,8 +401,8 @@
existing.actorId = req.actorId;
} else {
this.#actorPendingRequests.set(requestIdStr, {
resolve: () => {},
reject: () => {},
resolve: () => { },
reject: () => { },
streamController: controller,
actorId: req.actorId,
});
Expand Down Expand Up @@ -552,7 +552,7 @@
val: {
code: 1011,
reason: "Actor not found",
retry: false,
hibernate: false,
},
});
return;
Expand All @@ -570,7 +570,7 @@
val: {
code: 1011,
reason: "Not Implemented",
retry: false,
hibernate: false,
},
});
return;
Expand Down Expand Up @@ -608,7 +608,7 @@
const dataBuffer =
typeof data === "string"
? (new TextEncoder().encode(data)
.buffer as ArrayBuffer)
.buffer as ArrayBuffer)
: data;

this.#sendMessage(requestId, {
Expand All @@ -619,14 +619,14 @@
},
});
},
(code?: number, reason?: string, retry: boolean = false) => {
(code?: number, reason?: string, hibernate: boolean = false) => {
// Send close through tunnel
this.#sendMessage(requestId, {
tag: "ToServerWebSocketClose",
val: {
code: code || null,
reason: reason || null,
retry,
hibernate,
},
});

Expand Down Expand Up @@ -656,8 +656,8 @@
headerInit[k] = v;
}
}
headerInit["Upgrade"] = "websocket";

Check notice on line 659 in engine/sdks/typescript/runner/src/tunnel.ts

View workflow job for this annotation

GitHub Actions / quality

lint/complexity/useLiteralKeys

The computed expression can be simplified without the use of a string literal.

Check notice on line 659 in engine/sdks/typescript/runner/src/tunnel.ts

View workflow job for this annotation

GitHub Actions / quality

lint/complexity/useLiteralKeys

The computed expression can be simplified without the use of a string literal.
headerInit["Connection"] = "Upgrade";

Check notice on line 660 in engine/sdks/typescript/runner/src/tunnel.ts

View workflow job for this annotation

GitHub Actions / quality

lint/complexity/useLiteralKeys

The computed expression can be simplified without the use of a string literal.

Check notice on line 660 in engine/sdks/typescript/runner/src/tunnel.ts

View workflow job for this annotation

GitHub Actions / quality

lint/complexity/useLiteralKeys

The computed expression can be simplified without the use of a string literal.

const request = new Request(`http://localhost${open.path}`, {
method: "GET",
Expand Down Expand Up @@ -700,7 +700,7 @@
val: {
code: 1011,
reason: "Server Error",
retry: false,
hibernate: false,
},
});

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

export class WebSocketTunnelAdapter {
#webSocketId: string;

Check warning on line 7 in engine/sdks/typescript/runner/src/websocket-tunnel-adapter.ts

View workflow job for this annotation

GitHub Actions / quality

lint/correctness/noUnusedPrivateClassMembers

This private class member is defined but never used.

Check warning on line 7 in engine/sdks/typescript/runner/src/websocket-tunnel-adapter.ts

View workflow job for this annotation

GitHub Actions / quality

lint/correctness/noUnusedPrivateClassMembers

This private class member is defined but never used.
#readyState: number = 0; // CONNECTING
#eventListeners: Map<string, Set<(event: any) => void>> = new Map();
#onopen: ((this: any, ev: any) => any) | null = null;
Expand Down Expand Up @@ -215,7 +215,7 @@
closeInner(
code: number | undefined,
reason: string | undefined,
retry: boolean,
hibernate: boolean,
callback: boolean,
): void {
if (
Expand All @@ -229,7 +229,7 @@

// Send close through tunnel
if (callback) {
this.#closeCallback(code, reason, retry);
this.#closeCallback(code, reason, hibernate);
}

// Update state and fire event
Expand All @@ -249,7 +249,7 @@
addEventListener(
type: string,
listener: (event: any) => void,
options?: boolean | any,

Check warning on line 252 in engine/sdks/typescript/runner/src/websocket-tunnel-adapter.ts

View workflow job for this annotation

GitHub Actions / quality

lint/correctness/noUnusedFunctionParameters

This parameter is unused.
): void {
if (typeof listener === "function") {
let listeners = this.#eventListeners.get(type);
Expand All @@ -267,7 +267,7 @@
removeEventListener(
type: string,
listener: (event: any) => void,
options?: boolean | any,

Check warning on line 270 in engine/sdks/typescript/runner/src/websocket-tunnel-adapter.ts

View workflow job for this annotation

GitHub Actions / quality

lint/correctness/noUnusedFunctionParameters

This parameter is unused.
): void {
if (typeof listener === "function") {
const listeners = this.#eventListeners.get(type);
Expand Down Expand Up @@ -561,7 +561,7 @@
if (cb) cb(new Error("Ping not supported in tunnel adapter"));
}

pong(data?: any, mask?: boolean, cb?: (err: Error) => void): void {

Check warning on line 564 in engine/sdks/typescript/runner/src/websocket-tunnel-adapter.ts

View workflow job for this annotation

GitHub Actions / quality

lint/correctness/noUnusedFunctionParameters

This parameter is unused.

Check warning on line 564 in engine/sdks/typescript/runner/src/websocket-tunnel-adapter.ts

View workflow job for this annotation

GitHub Actions / quality

lint/correctness/noUnusedFunctionParameters

This parameter is unused.
// Not implemented for tunnel - could be added if needed
if (cb) cb(new Error("Pong not supported in tunnel adapter"));
}
Expand Down
Loading