Revert "added queue processor to file decryption"
This reverts commit 3cab5372e9
.
This commit is contained in:
parent
9a24f617ca
commit
46471d4c25
|
@ -7,7 +7,6 @@ import { Collection } from './collectionService';
|
|||
import HTTPService from './HTTPService';
|
||||
import { logError } from 'utils/sentry';
|
||||
import { decryptFile, sortFiles } from 'utils/file';
|
||||
import QueueProcessor from './upload/queueProcessor';
|
||||
|
||||
const ENDPOINT = getEndpoint();
|
||||
const DIFF_LIMIT: number = 1000;
|
||||
|
@ -86,7 +85,6 @@ export const NEW_MAGIC_METADATA: MagicMetadata = {
|
|||
header: null,
|
||||
count: 0,
|
||||
};
|
||||
const PARALLEL_FILE_DECRYPTION = 20;
|
||||
|
||||
export const getLocalFiles = async () => {
|
||||
const files: Array<File> = (await localForage.getItem<File[]>(FILES)) || [];
|
||||
|
@ -192,18 +190,17 @@ export const getFiles = async (
|
|||
'X-Auth-Token': token,
|
||||
}
|
||||
);
|
||||
const fileDecrypter = new QueueProcessor(PARALLEL_FILE_DECRYPTION);
|
||||
for (let file of resp.data.diff) {
|
||||
if (!file.isDeleted) {
|
||||
file = await fileDecrypter.queueUpRequest(() =>
|
||||
decryptFile(file, collection)
|
||||
).promise;
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
decryptedFiles.push(file);
|
||||
}
|
||||
|
||||
decryptedFiles.push(
|
||||
...(await Promise.all(
|
||||
resp.data.diff.map(async (file: File) => {
|
||||
if (!file.isDeleted) {
|
||||
file = await decryptFile(file, collection);
|
||||
}
|
||||
return file;
|
||||
}) as Promise<File>[]
|
||||
))
|
||||
);
|
||||
|
||||
if (resp.data.diff.length) {
|
||||
time = resp.data.diff.slice(-1)[0].updationTime;
|
||||
|
|
Loading…
Reference in a new issue