Miss any of our Open RFC calls?Watch the recordings here! »

block-failed

0.0.1 • Public • Published

node-block-failed

// blocker will block for BLOCKED_DURATION_MS if ATTEMPT_COUNT failed attempts are made within ATTEMPT_DURATION_MS
blocker = blockFailed(BLOCKED_DURATION_MS, ATTEMPT_DURATION_MS, ATTEMPT_COUNT)
// blocker is now (key, on_attempt, on_block) => void
// on_attempt is on_failure => ...
// on_block is blockDurationMS => ...
...

block(ip_address, on_failure =>
{
  try
  {
    ...
  }
  catch (e)
  {
    if (!on_failure())
    {
      console.log('operation failed. please try again');
    }
  }
},
blockDurationMS =>
{
  console.log('operation blocked. please try again in', blockDurationMS, 'ms');
});

Keywords

none

Install

npm i block-failed

DownloadsWeekly Downloads

3

Version

0.0.1

License

MIT

Last publish

Collaborators

  • avatar