Add maximum wait in updateGroup, log with queue size in profile service
This commit is contained in:
parent
1cfc396d65
commit
5c3b866883
2 changed files with 14 additions and 2 deletions
10
ts/groups.ts
10
ts/groups.ts
|
@ -23,7 +23,7 @@ import dataInterface from './sql/Client';
|
||||||
import { toWebSafeBase64, fromWebSafeBase64 } from './util/webSafeBase64';
|
import { toWebSafeBase64, fromWebSafeBase64 } from './util/webSafeBase64';
|
||||||
import { assertDev, strictAssert } from './util/assert';
|
import { assertDev, strictAssert } from './util/assert';
|
||||||
import { isMoreRecentThan } from './util/timestamp';
|
import { isMoreRecentThan } from './util/timestamp';
|
||||||
import { MINUTE, DurationInSeconds } from './util/durations';
|
import { MINUTE, DurationInSeconds, SECOND } from './util/durations';
|
||||||
import { dropNull } from './util/dropNull';
|
import { dropNull } from './util/dropNull';
|
||||||
import type {
|
import type {
|
||||||
ConversationAttributesType,
|
ConversationAttributesType,
|
||||||
|
@ -93,6 +93,7 @@ import {
|
||||||
import { ReadStatus } from './messages/MessageReadStatus';
|
import { ReadStatus } from './messages/MessageReadStatus';
|
||||||
import { SeenStatus } from './MessageSeenStatus';
|
import { SeenStatus } from './MessageSeenStatus';
|
||||||
import { incrementMessageCounter } from './util/incrementMessageCounter';
|
import { incrementMessageCounter } from './util/incrementMessageCounter';
|
||||||
|
import { sleep } from './util/sleep';
|
||||||
|
|
||||||
type AccessRequiredEnum = Proto.AccessControl.AccessRequired;
|
type AccessRequiredEnum = Proto.AccessControl.AccessRequired;
|
||||||
|
|
||||||
|
@ -3135,7 +3136,12 @@ async function updateGroup(
|
||||||
|
|
||||||
if (changeMessagesToSave.length > 0) {
|
if (changeMessagesToSave.length > 0) {
|
||||||
try {
|
try {
|
||||||
await profileFetches;
|
if (contactsWithoutProfileKey && contactsWithoutProfileKey.length > 0) {
|
||||||
|
await Promise.race([profileFetches, sleep(30 * SECOND)]);
|
||||||
|
log.info(
|
||||||
|
`updateGroup/${logId}: timed out or finished fetching ${contactsWithoutProfileKey.length} profiles`
|
||||||
|
);
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error(
|
log.error(
|
||||||
`updateGroup/${logId}: failed to fetch missing profiles`,
|
`updateGroup/${logId}: failed to fetch missing profiles`,
|
||||||
|
|
|
@ -141,6 +141,12 @@ export class ProfileService {
|
||||||
`ProfileServices.get: Job for ${conversation.idForLogging()} finished ${delta}ms after queue`
|
`ProfileServices.get: Job for ${conversation.idForLogging()} finished ${delta}ms after queue`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
const remainingItems = this.jobQueue.size;
|
||||||
|
if (remainingItems && remainingItems % 10 === 0) {
|
||||||
|
log.info(
|
||||||
|
`ProfileServices.get: ${remainingItems} jobs remaining in the queue`
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue