feat: remove clustering to improve caching
This commit is contained in:
+8
-21
@@ -1,26 +1,13 @@
|
|||||||
import cluster from "node:cluster";
|
|
||||||
import process from "node:process";
|
import process from "node:process";
|
||||||
import { AssetManager } from "./lib/assets";
|
import { AssetManager } from "./lib/assets";
|
||||||
|
|
||||||
declare global {
|
queueMicrotask(async () => {
|
||||||
var forked: boolean;
|
const assets = new AssetManager();
|
||||||
}
|
assets.getMissingAssets();
|
||||||
|
|
||||||
if (cluster.isPrimary) {
|
setInterval(() => {
|
||||||
if (!globalThis.forked) {
|
|
||||||
for (let i = 0; i < 2; i++) cluster.fork();
|
|
||||||
globalThis.forked = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
queueMicrotask(async () => {
|
|
||||||
const assets = new AssetManager();
|
|
||||||
assets.getMissingAssets();
|
assets.getMissingAssets();
|
||||||
|
}, 86400000); // refresh assets every 24 hours
|
||||||
setInterval(() => {
|
});
|
||||||
assets.getMissingAssets();
|
await import("./server");
|
||||||
}, 86400000); // refresh assets every 24 hours
|
console.log(`Worker ${process.pid} started`);
|
||||||
});
|
|
||||||
} else {
|
|
||||||
await import("./server");
|
|
||||||
console.log(`Worker ${process.pid} started`);
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user