Action-CircuitBreaker

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN


METHODS

 run

    Does the following:

    step 1

      Tests the value of _circuit_open_until. If it is positive and the
      current timestamp is before the value, an error is thrown, because
      the circuit is still open. If the value is positive, but before the
      current timestamp, the circuit is closed (by setting
      _circuit_open_until to 0) and optionally, on_circuit_close is run.

    step 2

      If the value of _circuit_open_until is 0, the circuit is closed, and
      the passed sub gets executed. Then it runs the error_if_code CodeRef
      in scalar context, giving it as arguments $error, and the return
      values of $attempt_code. If it returns true, we consider that it was

lib/Action/CircuitBreaker.pm  view on Meta::CPAN


=head2 run

Does the following:

=over

=item step 1

Tests the value of C<_circuit_open_until>. If it is positive and the current
timestamp is before the value, an error is thrown, because the circuit is
still open. If the value is positive, but before the current timestamp,
the circuit is closed (by setting C<_circuit_open_until> to 0) and optionally,
C<on_circuit_close> is run.

=item step 2

If the value of C<_circuit_open_until> is 0, the circuit is closed, and the
passed sub gets executed. Then it runs the C<error_if_code> CodeRef in
scalar context, giving it as arguments C<$error>, and the return values
of C<$attempt_code>. If it returns true, we consider that it was a failure,



( run in 0.393 second using v1.01-cache-2.11-cpan-496ff517765 )