Fix: Prevent hung worker process on flush exceptions (#1501)
* deprecate cli logger warn and error methods * replace broken error logger in deployed workers * changeset
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"trigger.dev": patch
|
||||
---
|
||||
|
||||
Prevent certain log statements from hanging deployed worker processes
|
||||
@@ -84,7 +84,7 @@ export class TaskRunProcess {
|
||||
try {
|
||||
await this.#flush();
|
||||
} catch (err) {
|
||||
logger.error("Error flushing task run process", { err });
|
||||
console.error("Error flushing task run process", { err });
|
||||
}
|
||||
|
||||
await this.kill();
|
||||
@@ -94,7 +94,7 @@ export class TaskRunProcess {
|
||||
try {
|
||||
await this.#flush();
|
||||
} catch (err) {
|
||||
logger.error("Error flushing task run process", { err });
|
||||
console.error("Error flushing task run process", { err });
|
||||
}
|
||||
|
||||
if (kill) {
|
||||
|
||||
@@ -58,7 +58,9 @@ export class Logger {
|
||||
};
|
||||
info = (...args: unknown[]) => this.doLog("info", args);
|
||||
log = (...args: unknown[]) => this.doLog("log", args);
|
||||
/** @deprecated **ONLY USE THIS IN THE CLI** - It will hang the process when used in deployed code (!) */
|
||||
warn = (...args: unknown[]) => this.doLog("warn", args);
|
||||
/** @deprecated **ONLY USE THIS IN THE CLI** - It will hang the process when used in deployed code (!) */
|
||||
error = (...args: unknown[]) => this.doLog("error", args);
|
||||
table<Keys extends string>(data: TableRow<Keys>[], level?: Exclude<LoggerLevel, "none">) {
|
||||
const keys: Keys[] = data.length === 0 ? [] : (Object.keys(data[0]!) as Keys[]);
|
||||
|
||||
Reference in New Issue
Block a user