Skip to content

Commit bebb8ae

Browse files
committed
fix(rivetkit): reject all waiters in SinglePromiseQueue (#3392)
1 parent c02a5d7 commit bebb8ae

File tree

1 file changed

+15
-6
lines changed
  • rivetkit-typescript/packages/rivetkit/src

1 file changed

+15
-6
lines changed

rivetkit-typescript/packages/rivetkit/src/utils.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,18 @@ export { assertUnreachable } from "./common/utils";
33

44
import type { Context as HonoContext, Handler as HonoHandler } from "hono";
55
import { stringify as uuidstringify } from "uuid";
6-
6+
import { stringifyError } from "@/common/utils";
77
import pkgJson from "../package.json" with { type: "json" };
8+
import { getLogger } from "./common/log";
89

910
export const VERSION = pkgJson.version;
1011

1112
let _userAgent: string | undefined;
1213

14+
function logger() {
15+
return getLogger("utils");
16+
}
17+
1318
export function httpUserAgent(): string {
1419
// Return cached value if already initialized
1520
if (_userAgent !== undefined) {
@@ -177,12 +182,16 @@ export class SinglePromiseQueue {
177182

178183
try {
179184
await op();
180-
} catch {
181-
// Swallow errors: callers only await cycle completion, not success
185+
// Notify all waiters for this cycle
186+
resolver?.resolve();
187+
} catch (err) {
188+
logger().error({
189+
msg: "error in SinglePromiseQueue drain loop",
190+
error: stringifyError(err),
191+
});
192+
// Reject all waiters for this cycle
193+
resolver?.reject(err);
182194
}
183-
184-
// Notify all waiters for this cycle
185-
resolver?.resolve();
186195
}
187196
} finally {
188197
this.runningDrainLoop = undefined;

0 commit comments

Comments
 (0)