pip install huey python from huey import RedisHuey huey = RedisHuey() @huey.task() def send_email(to, subject, content): print(f"Sending email to {to}, Subject: {subject}, Content: {content}") python from huey import RedisHuey huey = RedisHuey(url="redis://localhost:6379/0") huey_consumer.py huey_config.huey python from huey_config import huey from datetime import datetime, timedelta execute_at = datetime.now() + timedelta(seconds=60) huey.enqueue_at(execute_at, send_email, "receiver@example.com", "Hello", "This is the content of the email")


上一篇:
下一篇:
切换中文