Skip to content

Commit

Permalink
Added some introspection on configured paces.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ktmi committed Jul 3, 2024
1 parent a239c7e commit 239d6de
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions kytos/core/pacing.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ def hit(self, action_name: str, *keys):

time.sleep(sleep_time)

def is_configured(self, action_name):
"""
Check if the given action has been configured.
"""
return action_name in self.pace_config

class PacerWrapper:
"""
Expand Down Expand Up @@ -215,5 +220,13 @@ async def ahit(self, action_name: str, *keys):
*keys
)

def is_configured(self, action_name: str):
"""
Check if the given action has been configured.
"""
return self.pacer.is_configured(
self._localized_key(action_name)
)

def _localized_key(self, key):
return f"{self.namespace}.{key}"

0 comments on commit 239d6de

Please sign in to comment.