Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time window with exponential backoff #279

Open
2 tasks done
KaranH15 opened this issue Dec 15, 2022 · 2 comments
Open
2 tasks done

Time window with exponential backoff #279

KaranH15 opened this issue Dec 15, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@KaranH15
Copy link

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the feature has not already been requested

馃殌 Feature Proposal

Right now in timeWindow option we can set retries for regular interval of time. There is no option for allowing exponential backoff time. E.g If I want user to retry for following time windows - 1min, 5 min, 15min ........ No option to configure that rn.

Motivation

No response

Example

No response

@climba03003
Copy link
Member

The current implementation do not keep how many times for an ip to be banned.
Those data would require a persistence storage other than redis.

I think the idea good, but not sure if it worth for storing such data.

@Uzlopak
Copy link
Contributor

Uzlopak commented Dec 15, 2022

Just because I have the code currently open in my vscode: Exponential back off can be implemented by the following code:

/**
 * Exponential backoff is the process of a client periodically retrying a
 * failed request over an increasing amount of time. It is a standard error
 * handling strategy for network applications. The Core Reporting API is
 * designed with the expectation that clients which choose to retry failed
 * requests do so using exponential backoff. Besides being "required", using
 * exponential backoff increases the efficiency of bandwidth usage, reduces
 * the number of requests required to get a successful response, and
 * maximizes the throughput of requests in concurrent environments.
 *
 * @see https://developers.google.com/analytics/devguides/reporting/core/v3/errors#backoff
 */
function exponentialDelay(retryNumber) {
	const delayInSeconds = Math.pow(2, retryNumber)
	const randomMs = ~~(1000 * Math.random())
	return delayInSeconds * 1000 + randomMs
}

@gurgunday gurgunday added the enhancement New feature or request label Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants