Open vilaemail opened 1 year ago
Repro code:
const retry = require('retry'); const testCase = (configAmmend) => { return new Promise((resolve) => { const op = retry.operation({ retries: 1, minTimeout: 800, factor: 1, ...configAmmend }); const startTime = Date.now(); op.attempt((attempt) => { console.log(`${attempt}: ${Date.now() - startTime}`); op.retry(new Error('fail on purpose')); if (attempt === 2) { resolve(); } }); }); }; const test = async () => { console.log('test 1'); await testCase({}); console.log('test 2'); await testCase({ maxTimeout: 1000 }); console.log('test 3'); await testCase({ maxTimeout: undefined }); } test();
Expected behavior:
test 1 1: 0 2: 809 test 2 1: 0 2: 810 test 3 1: 0 2: 809
Actual behavior:
test 1 1: 0 2: 809 test 2 1: 0 2: 810 test 3 1: 0 2: 15
Repro code:
Expected behavior:
Actual behavior: