Skip to content

Commit

Permalink
Dont autokill workers
Browse files Browse the repository at this point in the history
  • Loading branch information
pastelsky committed Jan 2, 2024
1 parent 121415e commit 8354e37
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions server/workers/docs-builder-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,17 @@ let workerActiveTime = Date.now();

setInterval(() => {
if (Date.now() - workerActiveTime > 1000 * 60 * 5) {
console.log("Worker remained idle for too long, dying.");
process.exit(1);
console.log(
"Worker remained idle for too long without doing much...",
process.pid,
" alive for ",
process.uptime(),
"s. Without work for ",
Date.now() - workerActiveTime,
"s",
);
}
});
}, 5000);

module.exports = async (job) => {
try {
Expand Down

0 comments on commit 8354e37

Please sign in to comment.