MCPcopy Index your code
hub / github.com/apache/pouchdb / backOff

Function backOff

lib/index.js:9688–9715  ·  view source on GitHub ↗
(opts, returnValue, error, callback)

Source from the content-addressed store, hash-verified

9686var STARTING_BACK_OFF = 0;
9687
9688function backOff(opts, returnValue, error, callback) {
9689 if (opts.retry === false) {
9690 returnValue.emit('error', error);
9691 returnValue.removeAllListeners();
9692 return;
9693 }
9694 /* istanbul ignore if */
9695 if (typeof opts.back_off_function !== 'function') {
9696 opts.back_off_function = defaultBackOff;
9697 }
9698 returnValue.emit('requestError', error);
9699 if (returnValue.state === 'active' || returnValue.state === 'pending') {
9700 returnValue.emit('paused', error);
9701 returnValue.state = 'stopped';
9702 var backOffSet = function backoffTimeSet() {
9703 opts.current_back_off = STARTING_BACK_OFF;
9704 };
9705 var removeBackOffSetter = function removeBackOffTimeSet() {
9706 returnValue.removeListener('active', backOffSet);
9707 };
9708 returnValue.once('paused', removeBackOffSetter);
9709 returnValue.once('active', backOffSet);
9710 }
9711
9712 opts.current_back_off = opts.current_back_off || STARTING_BACK_OFF;
9713 opts.current_back_off = opts.back_off_function(opts.current_back_off);
9714 setTimeout(callback, opts.current_back_off);
9715}
9716
9717function sortObjectPropertiesByKey(queryParams) {
9718 return Object.keys(queryParams).sort(collate).reduce(function (result, key) {

Callers 1

completeReplicationFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…