weixin_39816448
weixin_39816448
2020-12-09 00:24

FixedDelay strategy missed seconds and milliseconds

https://github.com/davegardnerisme/nsqphp/blob/master/src/nsqphp/RequeueStrategy/FixedDelay.php#L34

Seems, delay is in seconds

https://github.com/davegardnerisme/nsqphp/blob/master/src/nsqphp/RequeueStrategy/FixedDelay.php#L61

Here should be milliseconds.

该提问来源于开源项目:davegardnerisme/nsqphp

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

4条回答

  • weixin_39765625 weixin_39765625 5月前

    Are you saying that because of the value 50?

    I picked 50ms as a default, which does seem absurdly small looking at it now! Perhaps I should make the constructor comments clearer. Thoughts?

    点赞 评论 复制链接分享
  • weixin_39816448 weixin_39816448 5月前

    Agree. 50 ms is to small for retry delay.

    For example, I using in my project default delay of 30 seconds and increase it at every attempt but not more than 1 hour (delay = min(message.attempts * 30, 3600)).

    点赞 评论 复制链接分享
  • weixin_39765625 weixin_39765625 5月前

    That sounds like a good case for adding a new implementation of the RequeueStrategyInterface - eg: LinearBackoff class. Would be quite useful if you fancied submitting..? And yeah - I agree the default should be changed to something like 30s.

    点赞 评论 复制链接分享
  • weixin_39816448 weixin_39816448 5月前

    Just for lulz - my own implementation of requeue strategy for internal project - http://pastebin.com/TCG5RPiz

    点赞 评论 复制链接分享

相关推荐