Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在执行工单函数中,对于不正常的工单状态,记录日志,避免q-task不断重试 #2850

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

peixubin
Copy link
Contributor

q-task对于执行超时的工单,会进行重试。但是在执行函数中,对于不在执行态的工单,会简单的报错,造成工单不断的被q-task重试执行,极易发生执行队列阻塞。
修改内容:在执行工单函数中,对于不正常的工单状态,记录工作流日志(提醒用户检查工单实际执行情况),不报错,避免q-task不断重试。

Copy link

codecov bot commented Oct 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.39%. Comparing base (eb99790) to head (1d5b60f).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2850      +/-   ##
==========================================
+ Coverage   78.32%   78.39%   +0.07%     
==========================================
  Files         124      124              
  Lines       17524    17586      +62     
==========================================
+ Hits        13725    13787      +62     
  Misses       3799     3799              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@peixubin peixubin force-pushed the wf_error_handle branch 2 times, most recently from 1196096 to ec45d9b Compare October 27, 2024 07:40
@hhyo
Copy link
Owner

hhyo commented Oct 27, 2024

工单执行任务配置的是永不超时,执行动作本身不是幂等的也不应该有重试机制,建议通过任务下发时配置禁止重试https://django-q.readthedocs.io/en/latest/configure.html#ack-failures

@peixubin
Copy link
Contributor Author

工单执行任务配置的是永不超时,执行动作本身不是幂等的也不应该有重试机制,建议通过任务下发时配置禁止重试https://django-q.readthedocs.io/en/latest/configure.html#ack-failures

重试是 django-q的默认行为,没发现可禁用的配置,只是想通过其他方法解决。
如果使用ack-failures来解决,似乎应该将该配置默认启用,类似于最佳实践

@peixubin
Copy link
Contributor Author

再就是“工单状态不正确,禁止执行!”的报错,对于用户来说比较模糊,看不懂。实际上在超时的情况下,任务是还在后台执行。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants