目录

Huey

安装

Bash
  1. uv add huey redis

apps

Bash
  1. 'huey.contrib.djhuey',

settings

Bash
  1. HUEY = {
  2. "huey_class": "huey.RedisHuey", # Huey implementation to use.
  3. "name": DATABASES["default"]["NAME"], # Use db name for huey.
  4. "results": True,
  5. "store_none": False,
  6. "immediate": DEBUG,
  7. "utc": True,
  8. "blocking": True, # Perform blocking pop rather than poll Redis.
  9. "connection": {
  10. "host": "localhost",
  11. "port": 6379,
  12. "db": 0,
  13. "connection_pool": None, # Definitely you should use pooling!
  14. # ... tons of other options, see redis-py for details.
  15. # huey-specific connection parameters.
  16. "read_timeout": 1, # If not polling (blocking pop), use timeout.
  17. "url": None, # Allow Redis config via a DSN.
  18. },
  19. "consumer": {
  20. "workers": 1,
  21. "worker_type": "thread",
  22. "initial_delay": 0.1, # Smallest polling interval, same as -d.
  23. "backoff": 1.15, # Exponential backoff using this rate, -b.
  24. "max_delay": 10.0, # Max possible polling interval, -m.
  25. "scheduler_interval": 1, # Check schedule every second, -s.
  26. "periodic": True, # Enable crontab feature.
  27. "check_worker_health": True, # Enable worker health checks.
  28. "health_check_interval": 1, # Check worker health every second.
  29. },
  30. }