force one-line log (queue processor)
This commit is contained in:
parent
84a6877f57
commit
d84a5767bf
|
@ -68,6 +68,25 @@ function getJobInfo(job: Bull.Job | undefined, increment = false): string {
|
|||
return `id=${job.id} attempts=${currentAttempts}/${maxAttempts} age=${formated}`;
|
||||
}
|
||||
|
||||
function renderError(e: Error): any {
|
||||
if (e) { // 何故かeがundefinedで来ることがある
|
||||
return {
|
||||
...Object.getOwnPropertyNames(e).reduce((acc, key) => {
|
||||
//@ts-expect-error Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'Error'.
|
||||
acc[key] = e[key];
|
||||
return acc;
|
||||
}, {} as Record<string, any>),
|
||||
stack: e.stack?.split('\n').map(s => s.trim()),
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
stack: '?',
|
||||
message: '?',
|
||||
name: '?',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class QueueProcessorService implements OnApplicationShutdown {
|
||||
private logger: Logger;
|
||||
|
@ -118,18 +137,6 @@ export class QueueProcessorService implements OnApplicationShutdown {
|
|||
) {
|
||||
this.logger = this.queueLoggerService.logger;
|
||||
|
||||
function renderError(e: Error): any {
|
||||
if (e) { // 何故かeがundefinedで来ることがある
|
||||
return e;
|
||||
} else {
|
||||
return {
|
||||
stack: '?',
|
||||
message: '?',
|
||||
name: '?',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
//#region system
|
||||
this.systemQueueWorker = new Bull.Worker(QUEUE.SYSTEM, (job) => {
|
||||
switch (job.name) {
|
||||
|
|
Loading…
Reference in a new issue