print warning when activity processing exceeds 10 seonds
This commit is contained in:
@@ -105,6 +105,9 @@ export class InboxProcessorService implements OnApplicationShutdown {
|
|||||||
// Truncate nanoseconds to microseconds, then scale to milliseconds.
|
// Truncate nanoseconds to microseconds, then scale to milliseconds.
|
||||||
// 123,456,789 ns -> 123,456 us -> 123.456 ms
|
// 123,456,789 ns -> 123,456 us -> 123.456 ms
|
||||||
const duration = Number((endTime - startTime) / 1000n) / 1000;
|
const duration = Number((endTime - startTime) / 1000n) / 1000;
|
||||||
|
if (duration > 10000) {
|
||||||
|
this.logger.warn(`Activity ${JSON.stringify(payload.id)} by "${keyId}" took ${(duration / 1000).toFixed(1)} seconds to complete`);
|
||||||
|
}
|
||||||
|
|
||||||
log.accepted = result.startsWith('ok');
|
log.accepted = result.startsWith('ok');
|
||||||
log.duration = duration;
|
log.duration = duration;
|
||||||
|
|||||||
Reference in New Issue
Block a user