1.4.0 • Published 10 months ago

euthanasia v1.4.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

euthanasia

when your node.js process uses too much memory, allow it to gracefully exit

usage:

const euthanasia = require('euthanasia');

// if you need to do some cleanup you do it in an async ready function
// usage is in MB just like the first parameter of default function
const ready = async (usage) => {
  // whatever to want do after memory used > 256 MB
  console.info(`[OOM] Sorry but you used ${usage} MB`);

  // return false here to still keep on livin'
  // for example there are still connected active users
  return true;
};

// check is memory usage > than 256 MB, every minute
euthanasia(256, 60 * 1000, ready);

install:

npm i euthanasia --save

license:

MIT

1.4.0

10 months ago

1.3.0

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago