mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-04-28 17:46:56 +00:00
print warning when activity processing exceeds 10 seonds
This commit is contained in:
parent
e35e92beb9
commit
871c63b48b
1 changed files with 3 additions and 0 deletions
|
@ -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;
|
||||||
|
|
Loading…
Add table
Reference in a new issue