{"action":"created","issue":{"url":"https://api.github.com/repos/nsqio/go-nsq/issues/195","repository_url":"https://api.github.com/repos/nsqio/go-nsq","labels_url":"https://api.github.com/repos/nsqio/go-nsq/issues/195/labels{/name}","comments_url":"https://api.github.com/repos/nsqio/go-nsq/issues/195/comments","events_url":"https://api.github.com/repos/nsqio/go-nsq/issues/195/events","html_url":"https://github.com/nsqio/go-nsq/issues/195","id":180597409,"number":195,"title":"consumer: FullJitterStrategy may increase backoff counter unexpectedly","user":{"login":"judwhite","id":729716,"avatar_url":"https://avatars.githubusercontent.com/u/729716?v=3","gravatar_id":"","url":"https://api.github.com/users/judwhite","html_url":"https://github.com/judwhite","followers_url":"https://api.github.com/users/judwhite/followers","following_url":"https://api.github.com/users/judwhite/following{/other_user}","gists_url":"https://api.github.com/users/judwhite/gists{/gist_id}","starred_url":"https://api.github.com/users/judwhite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/judwhite/subscriptions","organizations_url":"https://api.github.com/users/judwhite/orgs","repos_url":"https://api.github.com/users/judwhite/repos","events_url":"https://api.github.com/users/judwhite/events{/privacy}","received_events_url":"https://api.github.com/users/judwhite/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nsqio/go-nsq/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/nsqio/go-nsq/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-10-03T09:30:46Z","updated_at":"2016-10-10T07:09:07Z","closed_at":null,"body":"https://github.com/nsqio/go-nsq/blob/3c0c5ed026c3a4b2ecc62c675fd4579c2ca65d16/consumer.go#L781-L786\r\n\r\nIf `FullJitterStrategy` calculates a value less than `config.MaxBackoffDuration` then `backoffCounter` will increment where `ExponentialStrategy` wouldn't, potentially causing `inBackoff()` and `RDY 1` to persist longer than intended.\r\n\r\nThis probably matters very little for most use cases, but during a prolonged outage and long-running handlers it could take a while to recover."},"comment":{"url":"https://api.github.com/repos/nsqio/go-nsq/issues/comments/252548478","html_url":"https://github.com/nsqio/go-nsq/issues/195#issuecomment-252548478","issue_url":"https://api.github.com/repos/nsqio/go-nsq/issues/195","id":252548478,"user":{"login":"judwhite","id":729716,"avatar_url":"https://avatars.githubusercontent.com/u/729716?v=3","gravatar_id":"","url":"https://api.github.com/users/judwhite","html_url":"https://github.com/judwhite","followers_url":"https://api.github.com/users/judwhite/followers","following_url":"https://api.github.com/users/judwhite/following{/other_user}","gists_url":"https://api.github.com/users/judwhite/gists{/gist_id}","starred_url":"https://api.github.com/users/judwhite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/judwhite/subscriptions","organizations_url":"https://api.github.com/users/judwhite/orgs","repos_url":"https://api.github.com/users/judwhite/repos","events_url":"https://api.github.com/users/judwhite/events{/privacy}","received_events_url":"https://api.github.com/users/judwhite/received_events","type":"User","site_admin":false},"created_at":"2016-10-10T07:09:07Z","updated_at":"2016-10-10T07:09:07Z","body":"@mreiferson Thanks for taking the time to read through this. I'll raise a PR to change `Calculate`, I think it's more understandable than a method calculating the max backoff level.\r\n\r\nI noticed the code starts the backoff counter at 1, which means the lowest backoff will be `(2^1)*cfg.BackoffMultiplier`. I think passing 1 to `Calculate` is expected, and the strategy should multiply by `2^(n-1)`. There are tests for this but they start `attempt` at 0, which it'll never be.\r\n\r\nIt's been like this for a [while](https://github.com/nsqio/go-nsq/commit/82a05da29e2ba5d7e3125d7fca3acd395c4044fc#diff-ed6ec976ee948cb81f2bbef47adb704dR563) but the [tests are more recent](https://github.com/nsqio/go-nsq/commit/5b9ccb80c56324e3f2851d9a4745c751fe4c2ace#diff-fb6a7899d06670e0e85669d2652ba911R59)."}}
{"actor":{"display_login":"judwhite"}}