Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
原先任务是同步执行的,因此在调度器设置任务超时时间之后,任务即使超时也依然会照常执行,并且正常返回结果且不会触发超时重试。此次修改之后,任务在超时的时候,会回调调度器返回任务超时,如果任务正常结束,则正常返回。
因为go无法强制kill协程,只能协程自己退出。因此虽然任务超时并且回调调度器,但是此任务仍然会执行完毕,不会中止,因此如果有超时重试机制,则可能会同时执行两个相同的任务。