- Fix bare imports in core/ modules to use fully-qualified paths (core.users, core.postgres) - Fix scheduler/daemon.py importing os before use - Fix verifyLoginToken returning truthy 401 on failure (security: invalid tokens were passing auth checks) - Fix api/routes/example.py passing literal True as userUUID instead of decoded JWT sub - Switch all services to python -m invocation so /app is always on sys.path - Remove orphaned sys.path.insert hacks from bot.py, commands/example.py, routes/example.py - Change API port mapping from 5000 to 8080 - Add config/.env and root .env for docker-compose variable substitution Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
37 lines
725 B
Python
37 lines
725 B
Python
"""
|
|
daemon.py - Background polling loop for scheduled tasks
|
|
|
|
Override poll_callback() with your domain-specific logic.
|
|
"""
|
|
|
|
import os
|
|
import time
|
|
import logging
|
|
|
|
logging.basicConfig(level=logging.INFO)
|
|
logger = logging.getLogger(__name__)
|
|
|
|
POLL_INTERVAL = int(os.environ.get("POLL_INTERVAL", 60))
|
|
|
|
|
|
def poll_callback():
|
|
"""
|
|
Override this function with your domain logic.
|
|
Called every POLL_INTERVAL seconds.
|
|
"""
|
|
pass
|
|
|
|
|
|
def daemon_loop():
|
|
logger.info("Scheduler daemon starting")
|
|
while True:
|
|
try:
|
|
poll_callback()
|
|
except Exception as e:
|
|
logger.error(f"Poll callback error: {e}")
|
|
time.sleep(POLL_INTERVAL)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
daemon_loop()
|