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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change: Improve rate limit algorithm for requests against the NVT API #918

Merged
merged 1 commit into from
Nov 3, 2023

Conversation

bjoernricks
Copy link
Contributor

@bjoernricks bjoernricks commented Nov 3, 2023

What

Improve rate limit algorithm for requests against the NVD API

Why

The original algorithm was very simple by just applying a pause after a specific number of allowed requests. When doing additional costly tasks after each requests this algorithm results in unnecessary delays and the sleep might be completely obsolete. Therefore calculate the time since the last check for a sleep. If this time delta is within the rate limit we wait for the required time before doing the next request.

Checklist

  • Tests

Copy link

github-actions bot commented Nov 3, 2023

Conventional Commits Report

Type Number
Changed 1

🚀 Conventional commits found.

The original algorithm was very simple by just applying a pause after a
specific number of allowed requests. When doing additional costly tasks
after each requests this algorithm results in unnecessary delays and the
sleep might be completely obsolete. Therefore calculate the time since
the last check for a sleep. If this time delta is within the rate limit
we wait for the required time before doing the next request.
@greenbonebot greenbonebot merged commit 4b72fd8 into main Nov 3, 2023
18 checks passed
@greenbonebot greenbonebot deleted the nvd-rate-limit branch November 3, 2023 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants