Skip to content

Commit

Permalink
Use clientside ratelimiting with same parameters as Node.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Wout Feys committed Sep 3, 2024
1 parent e1e5ace commit c35e37a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions aikido_firewall/background_process/aikido_background_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
)
from aikido_firewall.helpers.check_env_for_blocking import check_env_for_blocking
from aikido_firewall.helpers.token import get_token_from_env
from aikido_firewall.background_process.api.http_api import ReportingApiHTTP
from aikido_firewall.background_process.api.http_api_ratelimited import (
ReportingApiHTTPRatelimited,
)
from .commands import process_incoming_command

EMPTY_QUEUE_INTERVAL = 5 # 5 seconds
Expand Down Expand Up @@ -70,7 +72,11 @@ def reporting_thread(self):
) # Create an event scheduler
self.send_to_connection_manager(event_scheduler)

api = ReportingApiHTTP("https://guard.aikido.dev/")
api = ReportingApiHTTPRatelimited(

Check warning on line 75 in aikido_firewall/background_process/aikido_background_process.py

View check run for this annotation

Codecov / codecov/patch

aikido_firewall/background_process/aikido_background_process.py#L75

Added line #L75 was not covered by tests
"https://guard.aikido.dev/",
max_events_per_interval=2,
interval_in_ms=15 * 1000,
)
# We need to pass along the scheduler so that the heartbeat also gets sent
self.connection_manager = CloudConnectionManager(
block=check_env_for_blocking(),
Expand Down

0 comments on commit c35e37a

Please sign in to comment.