Update backup media idle state after resuming download
This commit is contained in:
parent
0295cb3963
commit
ca20d07f75
4 changed files with 25 additions and 14 deletions
|
@ -17,7 +17,7 @@
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin-top: 64px;
|
margin-top: 72px;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,6 @@
|
||||||
.InstallScreenBackupImportStep__footer {
|
.InstallScreenBackupImportStep__footer {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 36px;
|
margin-bottom: 36px;
|
||||||
min-height: 94px;
|
min-height: 94px;
|
||||||
|
|
|
@ -88,9 +88,10 @@ export abstract class JobManager<CoreJobType> {
|
||||||
|
|
||||||
async start(): Promise<void> {
|
async start(): Promise<void> {
|
||||||
log.info(`${this.logPrefix}: starting`);
|
log.info(`${this.logPrefix}: starting`);
|
||||||
|
if (!this.enabled) {
|
||||||
this.enabled = true;
|
this.enabled = true;
|
||||||
await this.params.markAllJobsInactive();
|
await this.params.markAllJobsInactive();
|
||||||
|
}
|
||||||
await this.maybeStartJobs();
|
await this.maybeStartJobs();
|
||||||
this.tick();
|
this.tick();
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,9 +109,11 @@ import type { RawBodyRange } from '../../types/BodyRange';
|
||||||
import { fromAdminKeyBytes } from '../../util/callLinks';
|
import { fromAdminKeyBytes } from '../../util/callLinks';
|
||||||
import { getRoomIdFromRootKey } from '../../util/callLinksRingrtc';
|
import { getRoomIdFromRootKey } from '../../util/callLinksRingrtc';
|
||||||
import { loadAllAndReinitializeRedux } from '../allLoaders';
|
import { loadAllAndReinitializeRedux } from '../allLoaders';
|
||||||
import { resetBackupMediaDownloadProgress } from '../../util/backupMediaDownload';
|
import {
|
||||||
|
resetBackupMediaDownloadProgress,
|
||||||
|
startBackupMediaDownload,
|
||||||
|
} from '../../util/backupMediaDownload';
|
||||||
import { getEnvironment, isTestEnvironment } from '../../environment';
|
import { getEnvironment, isTestEnvironment } from '../../environment';
|
||||||
import { drop } from '../../util/drop';
|
|
||||||
import { hasAttachmentDownloads } from '../../util/hasAttachmentDownloads';
|
import { hasAttachmentDownloads } from '../../util/hasAttachmentDownloads';
|
||||||
|
|
||||||
const MAX_CONCURRENCY = 10;
|
const MAX_CONCURRENCY = 10;
|
||||||
|
@ -353,12 +355,7 @@ export class BackupImportStream extends Writable {
|
||||||
this.backupType !== BackupType.TestOnlyPlaintext &&
|
this.backupType !== BackupType.TestOnlyPlaintext &&
|
||||||
!isTestEnvironment(getEnvironment())
|
!isTestEnvironment(getEnvironment())
|
||||||
) {
|
) {
|
||||||
await AttachmentDownloadManager.start();
|
await startBackupMediaDownload();
|
||||||
drop(
|
|
||||||
AttachmentDownloadManager.waitForIdle(async () => {
|
|
||||||
await window.storage.put('backupMediaDownloadIdle', true);
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
done();
|
done();
|
||||||
|
|
|
@ -1,14 +1,28 @@
|
||||||
// Copyright 2024 Signal Messenger, LLC
|
// Copyright 2024 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
|
import { AttachmentDownloadManager } from '../jobs/AttachmentDownloadManager';
|
||||||
import { DataWriter } from '../sql/Client';
|
import { DataWriter } from '../sql/Client';
|
||||||
|
import { drop } from './drop';
|
||||||
|
|
||||||
|
export async function startBackupMediaDownload(): Promise<void> {
|
||||||
|
await window.storage.put('backupMediaDownloadPaused', false);
|
||||||
|
await window.storage.put('backupMediaDownloadIdle', false);
|
||||||
|
|
||||||
|
await AttachmentDownloadManager.start();
|
||||||
|
drop(
|
||||||
|
AttachmentDownloadManager.waitForIdle(async () => {
|
||||||
|
await window.storage.put('backupMediaDownloadIdle', true);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export async function pauseBackupMediaDownload(): Promise<void> {
|
export async function pauseBackupMediaDownload(): Promise<void> {
|
||||||
await window.storage.put('backupMediaDownloadPaused', true);
|
await window.storage.put('backupMediaDownloadPaused', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function resumeBackupMediaDownload(): Promise<void> {
|
export async function resumeBackupMediaDownload(): Promise<void> {
|
||||||
await window.storage.put('backupMediaDownloadPaused', false);
|
return startBackupMediaDownload();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function resetBackupMediaDownloadItems(): Promise<void> {
|
export async function resetBackupMediaDownloadItems(): Promise<void> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue