我正在使用Celery处理多个数据挖掘任务。这些任务之一连接到远程服务,该远程服务允许每个用户最多10个同时连接(换句话说,它可以在全局范围内超过10个连接,但是不能在每个单独的作业中超过10个连接)。
我正在寻找 THINK Token Bucket (rate limiting),但似乎找不到任何实现。
最佳答案
Celery具有速率限制功能,并包含通用 token 存储区实现。
设置任务的速率限制:
http://docs.celeryproject.org/en/latest/userguide/tasks.html#Task.rate_limit
或在运行时:
http://docs.celeryproject.org/en/latest/userguide/workers.html#rate-limits
token 桶实现在Kombu中
关于rabbitmq - Celery(Django)限速,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4857464/