Skip to content

Commit

Permalink
argh
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-does-weather committed Nov 4, 2024
1 parent 9be7b4b commit 217f6e7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions api-interop-layer/data/alerts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,20 @@ export const startAlertProcessing = () => {
// gets loaded in the background worker, don't recursively keep loading it.
if (isMainThread) {
const max = (0.7 * getHeapStatistics().heap_size_limit) / 1024 ** 2;
console.log(`===== SETTING WORKER MAX HEAP TO ${max} MB`);

const updater = new Worker(
path.join(import.meta.dirname, "backgroundUpdateTask.js"),
{ resourceLimits: { maxOldGenerationSizeMb: max } },
);
updater.on("message", updateFromBackground);

// If our background thread stops, restart it.
updater.on("exit", () => {
startAlertProcessing();
});

// Make it go. Otherwise it won't go.
updater.postMessage("start");
updater.postMessage("start", [...cachedAlerts.keys()]);
}
};

Expand Down

0 comments on commit 217f6e7

Please sign in to comment.