Repository navigation
- feature: also now monitors
cpu usage in %and allows exit of course also based on that - basically
cpuandmemoryare optional so you can just omit either of them
breaking change
input to euthanasia() is now a single configuration JSON
euthanasia({
memory: 100, // 100 MB limit
cpu: 80, // 80% CPU limit
interval: 10000, // check every 10 seconds
// called when either memory or CPU limit is exceeded
ready: async ({ memory, cpu }) => {
// your logic here
if (memory) {
console.log(`Memory limit exceeded: ${memory} MB`);
}
if (cpu) {
console.log(`CPU limit exceeded: ${cpu.toFixed(2)}%`);
}
// You can return false to skip exit (e.g., wait for cleanup)
return true;
}
});