force one-line log (queue processor)
This commit is contained in:
		| @@ -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) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 tamaina
					tamaina