V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
smallpython
V2EX  ›  Python

celery 的可见性超时应该设置在 server 端还是 worker 端?

  •  
  •   smallpython · 2019-08-16 10:18:49 +08:00 · 1960 次点击
    这是一个创建于 1686 天前的主题,其中的信息可能已经有所发展或是发生改变。
    BROKER_TRANSPORT_OPTIONS={'visibility_timeout': 1800}

    就这个参数

    感觉这个参数设置的不对

    任务老重复执行
    5 条回复    2019-08-16 21:24:30 +08:00
    Latin
        1
    Latin  
       2019-08-16 14:07:53 +08:00
    celery_once 了解一下
    smallpython
        2
    smallpython  
    OP
       2019-08-16 16:14:11 +08:00
    @Latin 我的任务重复是必现的,应该是我的逻辑有问题,

    原来没有出现过
    glasslion
        3
    glasslion  
       2019-08-16 17:05:17 +08:00
    你的任务是要延时很久才执行的吧, 超过了了这个 visibility_timeout(30 分钟)? 如果是的话, 目前无解
    smallpython
        4
    smallpython  
    OP
       2019-08-16 20:04:54 +08:00
    @glasslion 不延时,立即执行

    我初步排查,是因为 worker 认为任务执行失败了,又执行了一次,导致执行两次

    但是任务并没有失败,所以会存储两份结果
    cz5424
        5
    cz5424  
       2019-08-16 21:24:30 +08:00 via iPhone
    @smallpython 一般不会重试的,除非手动设定,立即执行的任务一般不会被重复发,看看是不是设置了相同的 worker 名字?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   964 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 20:47 · PVG 04:47 · LAX 13:47 · JFK 16:47
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.