Refactor rate limiter and datetime formatting

This commit is contained in:
2026-01-22 02:24:03 +01:00
parent f297a8d740
commit 04114ab659
8 changed files with 133 additions and 135 deletions

View File

@@ -8,7 +8,7 @@ import argon2
from .dns import DNSService
from .email import EmailService
from .models import create_tables, init_database
from .ratelimit import RateLimiter
from .ratelimit import BadLimiter, GoodLimiter
class Application:
@@ -32,7 +32,8 @@ class Application:
# Service instances (initialized separately)
self.dns_service = None
self.email_service = None
self.rate_limiter = None
self.good_limiter = None
self.bad_limiter = None
def init_database(self):
"""Initialize database connection and run migrations."""
@@ -50,10 +51,11 @@ class Application:
self.email_service = EmailService(self.config)
logging.info("Email service initialized")
def init_rate_limiter(self):
"""Initialize rate limiter."""
self.rate_limiter = RateLimiter(self.config)
logging.info("Rate limiter initialized")
def init_rate_limiters(self):
"""Initialize rate limiters."""
self.good_limiter = GoodLimiter(self.config)
self.bad_limiter = BadLimiter(self.config)
logging.info("Rate limiters initialized")
def signal_shutdown(self):
"""Signal the application to shut down."""