Skip to content

Commit

Permalink
fix the wroker concurrency number error
Browse files Browse the repository at this point in the history
  • Loading branch information
hsa00000 committed Jan 3, 2025
1 parent 0efe159 commit debc60b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gallery-frontend/src/store/workerStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ export const useWorkerStore = (isolationId: IsolationId) =>
imgWorker: Worker[]
postToWorkerList: postToWorkerType[] | undefined
} => ({
concurrencyNumber: Math.min(navigator.hardwareConcurrency, 1),
concurrencyNumber: Math.max(navigator.hardwareConcurrency, 1),
worker: null,
imgWorker: [],
postToWorkerList: undefined
}),
actions: {
initializeWorker(isolationId: IsolationId) {
console.log('concurrencyNumber is', this.concurrencyNumber)

if (this.worker === null) {
this.worker = new Worker(new URL('../worker/toDataWorker.ts', import.meta.url), {
type: 'module'
Expand Down

0 comments on commit debc60b

Please sign in to comment.