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