Implement restart attempt backoffs. #15

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@joshthecoder

This provides changes to the monitor needed to implement restart attempt delays in forever.
See issue #350 for details on this feature request.

I have expanded the options to include: delay, delayAlgorithm, and delayMax.
These are used to control the amount of delay between trying to restart a script.
I will send a PR for forever CLI to expose these new options.

The built-in algorithms so far are: incremental, exponential, and fibonacci.
These are implemented in backoff.js. The design allows for dropping in your own
algorithms by just passing a function for the 'delayAlgorithm' option.

Right now I use the "times" variable to compute the delays. The issue with that is it doesn't get
reset back to zero after a successful launch of the script. I am not sure if the right direction is to
introduce a new variable or fix "times" to reset to zero.

@joshthecoder joshthecoder Implement restart attempt backoffs.
Delay the time between script restarts based on the number of times
the script has been started. Provides three algoritms for computing the
delay and growing it based on the number of times (n).
2e39fe0
@indexzero
Member

@joshthecoder Code looks good. Can you add some tests?

@joshthecoder

@indexzero Sure I have some time today to write a few tests.

@indexzero
Member

@joshthecoder Ping. Any progress on those tests?

@indexzero
Member

Decided this wasn't the right direction for the project. See new issue #67

@indexzero indexzero closed this Aug 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment