{"action":"created","issue":{"url":"https://api.github.com/repos/pyfarm/pyfarm-agent/issues/217","labels_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/issues/217/labels{/name}","comments_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/issues/217/comments","events_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/issues/217/events","html_url":"https://github.com/pyfarm/pyfarm-agent/pull/217","id":57554850,"number":217,"title":"Make Retry Delay Minimum Configurable","user":{"login":"opalmer","id":255117,"avatar_url":"https://avatars.githubusercontent.com/u/255117?v=3","gravatar_id":"","url":"https://api.github.com/users/opalmer","html_url":"https://github.com/opalmer","followers_url":"https://api.github.com/users/opalmer/followers","following_url":"https://api.github.com/users/opalmer/following{/other_user}","gists_url":"https://api.github.com/users/opalmer/gists{/gist_id}","starred_url":"https://api.github.com/users/opalmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opalmer/subscriptions","organizations_url":"https://api.github.com/users/opalmer/orgs","repos_url":"https://api.github.com/users/opalmer/repos","events_url":"https://api.github.com/users/opalmer/events{/privacy}","received_events_url":"https://api.github.com/users/opalmer/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pyfarm/pyfarm-agent/labels/agent","name":"agent","color":"009800"},{"url":"https://api.github.com/repos/pyfarm/pyfarm-agent/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"opalmer","id":255117,"avatar_url":"https://avatars.githubusercontent.com/u/255117?v=3","gravatar_id":"","url":"https://api.github.com/users/opalmer","html_url":"https://github.com/opalmer","followers_url":"https://api.github.com/users/opalmer/followers","following_url":"https://api.github.com/users/opalmer/following{/other_user}","gists_url":"https://api.github.com/users/opalmer/gists{/gist_id}","starred_url":"https://api.github.com/users/opalmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opalmer/subscriptions","organizations_url":"https://api.github.com/users/opalmer/orgs","repos_url":"https://api.github.com/users/opalmer/repos","events_url":"https://api.github.com/users/opalmer/events{/privacy}","received_events_url":"https://api.github.com/users/opalmer/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/pyfarm/pyfarm-agent/milestones/4","labels_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/milestones/4/labels","id":929319,"number":4,"title":"0.8.2","description":"","creator":{"login":"opalmer","id":255117,"avatar_url":"https://avatars.githubusercontent.com/u/255117?v=3","gravatar_id":"","url":"https://api.github.com/users/opalmer","html_url":"https://github.com/opalmer","followers_url":"https://api.github.com/users/opalmer/followers","following_url":"https://api.github.com/users/opalmer/following{/other_user}","gists_url":"https://api.github.com/users/opalmer/gists{/gist_id}","starred_url":"https://api.github.com/users/opalmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opalmer/subscriptions","organizations_url":"https://api.github.com/users/opalmer/orgs","repos_url":"https://api.github.com/users/opalmer/repos","events_url":"https://api.github.com/users/opalmer/events{/privacy}","received_events_url":"https://api.github.com/users/opalmer/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":21,"state":"open","created_at":"2015-01-09T21:55:30Z","updated_at":"2015-02-17T04:38:47Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-02-13T03:30:44Z","updated_at":"2015-02-17T13:37:18Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/pyfarm/pyfarm-agent/pulls/217","html_url":"https://github.com/pyfarm/pyfarm-agent/pull/217","diff_url":"https://github.com/pyfarm/pyfarm-agent/pull/217.diff","patch_url":"https://github.com/pyfarm/pyfarm-agent/pull/217.patch"},"body":"While working on the tests for #215 it became apparent that it was not possible to globally configure the minimum for `http_retry_delay`.  This change fixes that and also fixes an existing test too."},"comment":{"url":"https://api.github.com/repos/pyfarm/pyfarm-agent/issues/comments/74668320","html_url":"https://github.com/pyfarm/pyfarm-agent/pull/217#issuecomment-74668320","issue_url":"https://api.github.com/repos/pyfarm/pyfarm-agent/issues/217","id":74668320,"user":{"login":"guidow","id":6033185,"avatar_url":"https://avatars.githubusercontent.com/u/6033185?v=3","gravatar_id":"","url":"https://api.github.com/users/guidow","html_url":"https://github.com/guidow","followers_url":"https://api.github.com/users/guidow/followers","following_url":"https://api.github.com/users/guidow/following{/other_user}","gists_url":"https://api.github.com/users/guidow/gists{/gist_id}","starred_url":"https://api.github.com/users/guidow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guidow/subscriptions","organizations_url":"https://api.github.com/users/guidow/orgs","repos_url":"https://api.github.com/users/guidow/repos","events_url":"https://api.github.com/users/guidow/events{/privacy}","received_events_url":"https://api.github.com/users/guidow/received_events","type":"User","site_admin":false},"created_at":"2015-02-17T13:37:18Z","updated_at":"2015-02-17T13:37:18Z","body":"This code returns the effective delay as ```return max(minimum, delay)```. This is problematic, because in practice ```minimum``` will be returned more often than any other value, skewing the randomness. This problem gets more pronounced with higher values for minimum, and as soon as minimum is equal to or larger than ```agent_http_retry_delay```, the randomness will be gone completely.\r\n\r\nWe are using this random delay to avoid livelock situations. If the master ends up refusing some requests because of overload because too many agents are attempting to make requests at the same time, it won't help us if they all wait the exact same time and try their request again at the same point. If an administrator explicitly and deliberately raises the minimum for delays, that probably means he is experiencing overload problems already – which makes it even more important that this works correctly.\r\n\r\nMy suggestion is:\r\n\r\n- Rename ```agent_http_retry_delay``` to ```agent_http_retry_delay_factor```\r\n- Rename ```minimum``` to ```offset```\r\n- Rewrite this function as ```return offset + random() * agent_http_retry_delay_factor```\r\n\r\nIt really doesn't need to be any more complex than this."}}