Removing a few console.log...
This commit is contained in:
1 parent
5a5931dbcd
commit
4502162a36
4 files changed
+54
-54
No files matched your search
@@ -19,12 +19,12 @@ export const init = () => {
|
||||
|
||||
worker.onmessage = (event: any) => {
|
||||
const { id, payload } = event.data;
|
||||
console.log({
|
||||
caller: 'dispatcher-main / message received',
|
||||
id,
|
||||
payload,
|
||||
dispatcherQueue: JSON.parse(JSON.stringify(dispatcherQueue)),
|
||||
});
|
||||
// console.log({
|
||||
// caller: 'dispatcher-main / message received',
|
||||
// id,
|
||||
// payload,
|
||||
// dispatcherQueue: JSON.parse(JSON.stringify(dispatcherQueue)),
|
||||
// });
|
||||
dispatcherQueue.queue.get(id).callBack(null, payload, id);
|
||||
if (!dispatcherQueue.queue.get(id).live) {
|
||||
cancelDispatch(id);
|
||||
@@ -36,11 +36,11 @@ const [watchDbStatus] = createWorkerSignal({
|
||||
provider: 'watchDb',
|
||||
});
|
||||
const dbReady = () => {
|
||||
console.log({
|
||||
caller: 'dispatcher-main / waiting',
|
||||
dbStatus: watchDbStatus(),
|
||||
dbReady: watchDbStatus()?.opened,
|
||||
});
|
||||
// console.log({
|
||||
// caller: 'dispatcher-main / waiting',
|
||||
// dbStatus: watchDbStatus(),
|
||||
// dbReady: watchDbStatus()?.opened,
|
||||
// });
|
||||
return watchDbStatus()?.opened;
|
||||
};
|
||||
|
||||
@@ -49,7 +49,7 @@ const dispatch = async (
|
||||
callBack?: (error: any, result: any, id?: number | undefined) => void,
|
||||
live?: boolean
|
||||
) => {
|
||||
console.log({ caller: 'dispatcher-main / dispatch', payload, callBack });
|
||||
// console.log({ caller: 'dispatcher-main / dispatch', payload, callBack });
|
||||
if (worker === undefined) {
|
||||
init();
|
||||
}
|
||||
@@ -73,11 +73,11 @@ const dispatch = async (
|
||||
payload: payload,
|
||||
};
|
||||
worker.postMessage(message);
|
||||
console.log({
|
||||
caller: 'dispatcher-main / message sent',
|
||||
message,
|
||||
dispatcherQueue,
|
||||
});
|
||||
// console.log({
|
||||
// caller: 'dispatcher-main / message sent',
|
||||
// message,
|
||||
// dispatcherQueue,
|
||||
// });
|
||||
};
|
||||
|
||||
export const cancelDispatch = (id: number) => {
|
||||
|
||||
@@ -67,35 +67,35 @@ onmessage = async function (e) {
|
||||
putAccount,
|
||||
};
|
||||
|
||||
console.log({ caller: 'dispatcher-worker / onmessage', e });
|
||||
// console.log({ caller: 'dispatcher-worker / onmessage', e });
|
||||
initDb();
|
||||
|
||||
await until(() => globalThis.dbReady, 100); // Wait until databases have been initialized in this worker
|
||||
const { id, payload } = e.data;
|
||||
var returnValue: any = 'unknownAction';
|
||||
if (payload.action in actions) {
|
||||
console.log({
|
||||
caller: 'dispatcher-worker / awaiting',
|
||||
id,
|
||||
payload,
|
||||
dbReady: globalThis.dbReady,
|
||||
});
|
||||
// console.log({
|
||||
// caller: 'dispatcher-worker / awaiting',
|
||||
// id,
|
||||
// payload,
|
||||
// dbReady: globalThis.dbReady,
|
||||
// });
|
||||
returnValue = await actions[<keyof typeof actions>payload.action]({
|
||||
...payload.params,
|
||||
_dispatchId: id,
|
||||
});
|
||||
}
|
||||
postMessage({ id: id, payload: returnValue });
|
||||
console.log({
|
||||
caller: 'dispatcher-worker / response sent',
|
||||
id,
|
||||
returnValue,
|
||||
dbReady: globalThis.dbReady,
|
||||
});
|
||||
// console.log({
|
||||
// caller: 'dispatcher-worker / response sent',
|
||||
// id,
|
||||
// returnValue,
|
||||
// dbReady: globalThis.dbReady,
|
||||
// });
|
||||
};
|
||||
|
||||
export const returnAgain = (id: number, returnValue: any) => {
|
||||
console.log({ caller: 'dispatcher-worker / returnAgain', id, returnValue });
|
||||
// console.log({ caller: 'dispatcher-worker / returnAgain', id, returnValue });
|
||||
postMessage({ id: id, payload: returnValue });
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user