Avoid spurious error log when waiting for contact syncs

This commit is contained in:
trevor-signal
2025-02-27 15:37:33 -05:00
committed by GitHub
parent 537ff3a820
commit c6fd321caf
3 changed files with 7 additions and 10 deletions

View File

@@ -1726,9 +1726,9 @@ export async function startApp(): Promise<void> {
log.info(`${logId}: postRegistrationSyncs not complete, sending sync`); log.info(`${logId}: postRegistrationSyncs not complete, sending sync`);
setIsInitialContactSync(true); setIsInitialContactSync(true);
const syncRequest = await sendSyncRequests(); contactSyncComplete = waitForEvent('contactSync:complete');
drop(sendSyncRequests());
hasSentSyncRequests = true; hasSentSyncRequests = true;
contactSyncComplete = syncRequest.contactSyncComplete;
} }
// 4. Download (or resume download) of link & sync backup // 4. Download (or resume download) of link & sync backup

View File

@@ -1,17 +1,12 @@
// Copyright 2025 Signal Messenger, LLC // Copyright 2025 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only // SPDX-License-Identifier: AGPL-3.0-only
import { waitForEvent } from '../shims/events';
import * as log from '../logging/log'; import * as log from '../logging/log';
import { singleProtoJobQueue } from '../jobs/singleProtoJobQueue'; import { singleProtoJobQueue } from '../jobs/singleProtoJobQueue';
import MessageSender from './SendMessage'; import MessageSender from './SendMessage';
import { toLogFormat } from '../types/errors'; import { toLogFormat } from '../types/errors';
export async function sendSyncRequests( export async function sendSyncRequests(): Promise<void> {
timeout?: number
): Promise<{ contactSyncComplete: Promise<void> }> {
const contactSyncComplete = waitForEvent('contactSync:complete', timeout);
log.info('sendSyncRequests: sending sync requests'); log.info('sendSyncRequests: sending sync requests');
try { try {
await Promise.all([ await Promise.all([
@@ -28,5 +23,4 @@ export async function sendSyncRequests(
); );
throw error; throw error;
} }
return { contactSyncComplete };
} }

View File

@@ -54,6 +54,7 @@ import type {
import type { SystemTraySetting } from '../types/SystemTraySetting'; import type { SystemTraySetting } from '../types/SystemTraySetting';
import { drop } from './drop'; import { drop } from './drop';
import { sendSyncRequests } from '../textsecure/syncRequests'; import { sendSyncRequests } from '../textsecure/syncRequests';
import { waitForEvent } from '../shims/events';
type SentMediaQualityType = 'standard' | 'high'; type SentMediaQualityType = 'standard' | 'high';
type NotificationSettingType = 'message' | 'name' | 'count' | 'off'; type NotificationSettingType = 'message' | 'name' | 'count' | 'off';
@@ -490,9 +491,11 @@ export function createIPCEvents(
isPrimary: () => window.textsecure.storage.user.getDeviceId() === 1, isPrimary: () => window.textsecure.storage.user.getDeviceId() === 1,
syncRequest: async () => { syncRequest: async () => {
const { contactSyncComplete } = await sendSyncRequests( const contactSyncComplete = waitForEvent(
'contactSync:complete',
5 * durations.MINUTE 5 * durations.MINUTE
); );
await sendSyncRequests();
return contactSyncComplete; return contactSyncComplete;
}, },
getLastSyncTime: () => window.storage.get('synced_at'), getLastSyncTime: () => window.storage.get('synced_at'),