Skip to content

Commit

Permalink
Fixed bug with sync pacing trying to use async strats
Browse files Browse the repository at this point in the history
  • Loading branch information
Ktmi committed Jun 5, 2024
1 parent ab386d1 commit 18321d8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions kytos/core/pacing.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def inject_config(self, config: dict[str, dict]):
}

# Validate
for action, (strat, pace) in next_config.items():
for action, (strat, _) in next_config.items():
LOG.info("Added pace for action %s", action)
if strat not in available_strategies:
raise ValueError(
Expand Down Expand Up @@ -106,13 +106,16 @@ def hit(self, action_name, *keys):
return
strat, pace = self.pace_config[action_name]
identifiers = pace, action_name, *keys
strategy = self.async_strategies[strat]
strategy = self.sync_strategies[strat]
while not strategy.hit(*identifiers):
window_reset, _ = strategy.get_window_stats(
*identifiers
)
sleep_time = window_reset - time.time()

if sleep_time <= 0:
continue

time.sleep(sleep_time)


Expand Down

0 comments on commit 18321d8

Please sign in to comment.