fix navigator not defined

This commit is contained in:
Abhinav 2022-08-01 10:51:30 +05:30
parent 7fd68cb1fc
commit 6132b2657a
2 changed files with 7 additions and 6 deletions

View file

@ -22,7 +22,7 @@ import {
SceneDetectionService,
SceneDetectionMethod,
} from 'types/machineLearning';
import { CONCURRENCY } from 'utils/common/concurrency';
import { getConcurrency } from 'utils/common/concurrency';
import { getDedicatedCryptoWorker } from 'utils/crypto';
import { ComlinkWorker } from 'utils/comlink';
import { logQueueStats } from 'utils/machineLearning';
@ -201,7 +201,7 @@ export class LocalMLSyncContext implements MLSyncContext {
this.nSyncedFiles = 0;
this.nSyncedFaces = 0;
this.concurrency = concurrency || CONCURRENCY;
this.concurrency = concurrency || getConcurrency();
console.log('Using concurrency: ', this.concurrency);
// timeout is added on downloads

View file

@ -1,4 +1,5 @@
export const CONCURRENCY = Math.max(
2,
Math.ceil(navigator.hardwareConcurrency / 2)
);
import { runningInBrowser } from '.';
export const getConcurrency = () =>
runningInBrowser() &&
Math.max(2, Math.ceil(navigator.hardwareConcurrency / 2));