Skip to content

Commit

Permalink
Add repeat message filter to pacing logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Ktmi committed Aug 28, 2024
1 parent 41cb266 commit e6c5089
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions kytos/core/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,13 @@ def _patch_core_loggers():
reloadable_mods = [module for mod_name, module in sys.modules.items()
if mod_name[:str_len] == match_str]
for module in reloadable_mods:
old_logger = module.LOG
module.LOG = logging.getLogger(module.__name__)
for handler in old_logger.handlers:
module.LOG.addHandler(handler)
for log_filter in old_logger.filters:
module.LOG.addFilter(log_filter)


@staticmethod
def loggers():
Expand Down
4 changes: 4 additions & 0 deletions kytos/core/pacing.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@
from limits import RateLimitItem, parse
from limits.storage import storage_from_string

from kytos.logging.filters import RepeateMessageFilter

LOG = logging.getLogger(__name__)

LOG.addFilter(RepeateMessageFilter(3.0, 512))


class EmptyStrategy(limits.strategies.FixedWindowRateLimiter):
"""Rate limiter, that doesn't actually rate limit."""
Expand Down

0 comments on commit e6c5089

Please sign in to comment.