smartcar / retryify

Wrap a function to retry on specific errors.
MIT License
11 stars 1 forks source link

feat: initialDelay before retry execution #76

Closed nbry closed 2 years ago

nbry commented 2 years ago

Changes

This PR is for adding an initialDelay option (open to suggestions for names). This is the amount of time in milliseconds to wait before any function attempts.

Test

The added test calls a retry-wrapped function with 1500 ms initial delay and 0 retries. The function flips a boolean flag after the delay. The test verifies the state of the flag before and after the delay.

"Fix" to other tests

I'm not sure if this was intentional, but all the tests had the parameters flip-flopped. It looks like the tester was attempting to override the default options, but instead passed the function first, thus using only defaults.

Retry wrapped function signature is (<options>, <function>). The tests were passing because the default options caught all the test cases.

codecov[bot] commented 2 years ago

Codecov Report

Merging #76 (229d9bd) into master (a5a4559) will not change coverage. The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master       #76   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines           43        47    +4     
=========================================
+ Hits            43        47    +4     
Impacted Files Coverage Δ
index.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a5a4559...229d9bd. Read the comment docs.

smartcar-ci commented 2 years ago

:tada: This PR is included in version 5.1.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: