Wrap eventHandlerQueue jobs with task with timeout
This commit is contained in:
parent
5cee260063
commit
d7a2669b49
7 changed files with 112 additions and 116 deletions
|
@ -3498,10 +3498,9 @@ export class ConversationModel extends window.Backbone
|
|||
): Promise<T> {
|
||||
this.jobQueue = this.jobQueue || new PQueue({ concurrency: 1 });
|
||||
|
||||
const taskWithTimeout = createTaskWithTimeout(
|
||||
callback,
|
||||
`conversation ${this.idForLogging()}`
|
||||
);
|
||||
const logId = `conversation.queueJob(${this.idForLogging()}, ${name})`;
|
||||
|
||||
const taskWithTimeout = createTaskWithTimeout(callback, logId);
|
||||
|
||||
const abortController = new AbortController();
|
||||
const { signal: abortSignal } = abortController;
|
||||
|
@ -3512,7 +3511,7 @@ export class ConversationModel extends window.Backbone
|
|||
const waitTime = startedAt - queuedAt;
|
||||
|
||||
if (waitTime > JOB_REPORTING_THRESHOLD_MS) {
|
||||
log.info(`Conversation job ${name} was blocked for ${waitTime}ms`);
|
||||
log.info(`${logId}: was blocked for ${waitTime}ms`);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -3524,7 +3523,7 @@ export class ConversationModel extends window.Backbone
|
|||
const duration = Date.now() - startedAt;
|
||||
|
||||
if (duration > JOB_REPORTING_THRESHOLD_MS) {
|
||||
log.info(`Conversation job ${name} took ${duration}ms`);
|
||||
log.info(`${logId}: took ${duration}ms`);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -2203,7 +2203,7 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
|
|||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const conversation = window.ConversationController.get(conversationId)!;
|
||||
const idLog = `handleDataMessage/${conversation.idForLogging()} ${message.idForLogging()}`;
|
||||
await conversation.queueJob('handleDataMessage', async () => {
|
||||
await conversation.queueJob(idLog, async () => {
|
||||
log.info(`${idLog}: starting processing in queue`);
|
||||
|
||||
// First, check for duplicates. If we find one, stop processing here.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue