Searching a new balance between the two web workers...

This commit is contained in:
vdv committed 2023-02-11 15:55:49 +01:00
1 parent 71bd820da9
commit 0e714ac361
8 files changed
+247 -201

No files matched your search

+8
View File
@@ -49,11 +49,19 @@ export const createWorkerSignal = (parameters: {
const id = JSON.stringify({ provider, params });
if (globalThis.exportQueue.has(id)) {
globalThis.exportQueue.get(id).count++;
console.log({
caller: 'solid-worker / createWorkerSignal / existing',
queueItem: globalThis.exportQueue.get(id),
});
return globalThis.exportQueue.get(id).signal;
}
const signal = createSignal(initialValue);
globalThis.exportQueue.set(id, { signal, count: 1 });
worker.postMessage({ ...parameters, _id: id });
console.log({
caller: 'solid-worker / createWorkerSignal / new',
queueItem: globalThis.exportQueue.get(id),
});
return signal;
};
+2 -2
View File
@@ -1,5 +1,5 @@
import { createEffect, createRoot, createSignal, Signal } from 'solid-js';
import { compactDb } from '../db-admin/compact';
import { watchDb } from '../db-admin/health';
declare global {
var importQueue: Map<string, any>;
@@ -8,7 +8,7 @@ declare global {
globalThis.importQueue = new Map<string, Signal<any>>();
const providers = {
compactDb,
watchDb,
};
onmessage = function (e) {