MCPcopy
hub / github.com/apache/pouchdb / backOff

Function backOff

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

Source from the content-addressed store, hash-verified

9681var STARTING_BACK_OFF = 0;
9682
9683function backOff(opts, returnValue, error, callback) {
9684 if (opts.retry === false) {
9685 returnValue.emit('error', error);
9686 returnValue.removeAllListeners();
9687 return;
9688 }
9689 /* istanbul ignore if */
9690 if (typeof opts.back_off_function !== 'function') {
9691 opts.back_off_function = defaultBackOff;
9692 }
9693 returnValue.emit('requestError', error);
9694 if (returnValue.state === 'active' || returnValue.state === 'pending') {
9695 returnValue.emit('paused', error);
9696 returnValue.state = 'stopped';
9697 var backOffSet = function backoffTimeSet() {
9698 opts.current_back_off = STARTING_BACK_OFF;
9699 };
9700 var removeBackOffSetter = function removeBackOffTimeSet() {
9701 returnValue.removeListener('active', backOffSet);
9702 };
9703 returnValue.once('paused', removeBackOffSetter);
9704 returnValue.once('active', backOffSet);
9705 }
9706
9707 opts.current_back_off = opts.current_back_off || STARTING_BACK_OFF;
9708 opts.current_back_off = opts.back_off_function(opts.current_back_off);
9709 setTimeout(callback, opts.current_back_off);
9710}
9711
9712function sortObjectPropertiesByKey(queryParams) {
9713 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…