fix: update onebox runtime dependencies
Release / build-and-release (push) Successful in 2m33s

Bump Onebox to 1.24.3 with current API/runtime dependencies, registry routing fixes, safer initial admin handling, and cleaner shutdown of Docker-backed resources.
This commit is contained in:
2026-05-08 15:39:02 +00:00
parent 61f72a4b7a
commit b0f9d71a18
12 changed files with 955 additions and 1015 deletions
+28 -2
View File
@@ -68,6 +68,9 @@ export class ProxyLogReceiver {
private port: number;
private running = false;
private connections: Set<Deno.TcpConn> = new Set();
private connectionReaders: Map<Deno.TcpConn, ReadableStreamDefaultReader<Uint8Array>> = new Map();
private connectionHandlers: Set<Promise<void>> = new Set();
private acceptTask: Promise<void> | null = null;
// Adaptive sampling state
private logCountWindow: number[] = []; // timestamps of recent logs
@@ -174,7 +177,7 @@ export class ProxyLogReceiver {
logger.success(`ProxyLogReceiver started on TCP port ${this.port}`);
// Start accepting connections in background
this.acceptConnections();
this.acceptTask = this.acceptConnections();
} catch (error) {
logger.error(`Failed to start ProxyLogReceiver: ${getErrorMessage(error)}`);
throw error;
@@ -190,7 +193,9 @@ export class ProxyLogReceiver {
try {
for await (const conn of this.server) {
this.connections.add(conn);
this.handleConnection(conn);
const handlerTask = this.handleConnection(conn);
this.connectionHandlers.add(handlerTask);
handlerTask.finally(() => this.connectionHandlers.delete(handlerTask));
}
} catch (error) {
if (this.running) {
@@ -207,6 +212,7 @@ export class ProxyLogReceiver {
logger.debug(`ProxyLogReceiver: Connection from ${remoteAddr.hostname}:${remoteAddr.port}`);
const reader = conn.readable.getReader();
this.connectionReaders.set(conn, reader);
const decoder = new TextDecoder();
let buffer = '';
@@ -232,7 +238,13 @@ export class ProxyLogReceiver {
logger.debug(`ProxyLogReceiver connection closed: ${getErrorMessage(error)}`);
}
} finally {
this.connectionReaders.delete(conn);
this.connections.delete(conn);
try {
reader.releaseLock();
} catch {
// Reader may already be released after cancellation during shutdown.
}
try {
conn.close();
} catch {
@@ -447,6 +459,11 @@ export class ProxyLogReceiver {
this.running = false;
// Cancel pending reads before closing sockets so background handlers can finish.
await Promise.allSettled(
Array.from(this.connectionReaders.values()).map((reader) => reader.cancel()),
);
// Close all connections
for (const conn of this.connections) {
try {
@@ -467,6 +484,15 @@ export class ProxyLogReceiver {
this.server = null;
}
if (this.acceptTask) {
await this.acceptTask.catch(() => {});
this.acceptTask = null;
}
await Promise.allSettled(this.connectionHandlers);
this.connectionHandlers.clear();
this.connectionReaders.clear();
// Clear clients
this.clients.clear();