{"action":"opened","issue":{"url":"https://api.github.com/repos/App-vNext/Polly/issues/308","repository_url":"https://api.github.com/repos/App-vNext/Polly","labels_url":"https://api.github.com/repos/App-vNext/Polly/issues/308/labels{/name}","comments_url":"https://api.github.com/repos/App-vNext/Polly/issues/308/comments","events_url":"https://api.github.com/repos/App-vNext/Polly/issues/308/events","html_url":"https://github.com/App-vNext/Polly/issues/308","id":255402285,"number":308,"title":"WaitAndRetry exceeded configured number of retries.","user":{"login":"vvucetic","id":1523657,"avatar_url":"https://avatars3.githubusercontent.com/u/1523657?v=4","gravatar_id":"","url":"https://api.github.com/users/vvucetic","html_url":"https://github.com/vvucetic","followers_url":"https://api.github.com/users/vvucetic/followers","following_url":"https://api.github.com/users/vvucetic/following{/other_user}","gists_url":"https://api.github.com/users/vvucetic/gists{/gist_id}","starred_url":"https://api.github.com/users/vvucetic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vvucetic/subscriptions","organizations_url":"https://api.github.com/users/vvucetic/orgs","repos_url":"https://api.github.com/users/vvucetic/repos","events_url":"https://api.github.com/users/vvucetic/events{/privacy}","received_events_url":"https://api.github.com/users/vvucetic/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-09-05T20:41:22Z","updated_at":"2017-09-05T20:41:22Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\n\r\nI have following setup:\r\n\r\n```\r\npublic static Policy Retry\r\n        {\r\n            get\r\n            {\r\n                return Policy\r\n                   .Handle<Exception>()\r\n                   .WaitAndRetry(3, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)), (exception, timeSpan, retryCount, context) =>\r\n                   {\r\n                       _logger.Warning(exception, $\"Retry {retryCount} at {context.ExecutionKey} due to: {exception.Message}.\", context.ContainsKey(\"contextId\") ? (Guid?)context[\"contextId\"] : null);\r\n                   });\r\n            }\r\n        }\r\n```\r\n\r\nCalling policy with cancellationToken passed as parameter to both executing method and to retry policy.\r\n\r\n```\r\nvar executionResult = ResiliencePolicyFactory.Retry.Execute((ct) => action.Execute(actionContext, ct), context: new Context(\"Context Name\", new Dictionary<string, object> { { \"contextId\", contextId } }), cancellationToken: cancellationToken);\r\n```\r\nI just noticed in my logs the following (notice retry attempt count):\r\n\r\n```\r\n{\"Timestamp\":\"2017-09-05T18:49:29.9494254+02:00\",\"Level\":\"Warning\",\"MessageTemplate\":\"Error occurred during execution of '{omitted}' process. Execution will be retried (attempt #1) in 00:00:00 seconds.\",\"Exception\":\"{omitted}\",\"Properties\":{\"ThreadId\":30}}\r\n{\"Timestamp\":\"2017-09-05T18:49:30.9727091+02:00\",\"Level\":\"Warning\",\"MessageTemplate\":\"Error occurred during execution of '{omitted}' process. Execution will be retried (attempt #2) in 00:00:02 seconds.\",\"Exception\":\"{omitted}\",\"Properties\":{\"ThreadId\":30}}\r\n{\"Timestamp\":\"2017-09-05T18:49:34.0248928+02:00\",\"Level\":\"Warning\",\"MessageTemplate\":\"Error occurred during execution of '{omitted}' process. Execution will be retried (attempt #3) in 00:00:05 seconds.\",\"Exception\":\"{omitted}\",\"Properties\":{\"ThreadId\":30}}\r\n{\"Timestamp\":\"2017-09-05T18:49:39.9354130+02:00\",\"Level\":\"Warning\",\"MessageTemplate\":\"Error occurred during execution of '{omitted}' process. Execution will be retried (attempt #4) in 00:00:14 seconds.\",\"Exception\":\"{omitted}\",\"Properties\":{\"ThreadId\":30}}\r\n{\"Timestamp\":\"2017-09-05T18:49:54.9148406+02:00\",\"Level\":\"Warning\",\"MessageTemplate\":\"Error occurred during execution of '{omitted}' process. Execution will be retried (attempt #5) in 00:00:25 seconds.\",\"Exception\":\"{omitted}\",\"Properties\":{\"ThreadId\":30}}\r\n{\"Timestamp\":\"2017-09-05T18:50:20.8642469+02:00\",\"Level\":\"Warning\",\"MessageTemplate\":\"Error occurred during execution of '{omitted}' process. Execution will be retried (attempt #6) in 00:00:35 seconds.\",\"Exception\":\"{omitted}\",\"Properties\":{\"ThreadId\":30}}\r\n{\"Timestamp\":\"2017-09-05T18:50:56.8358133+02:00\",\"Level\":\"Warning\",\"MessageTemplate\":\"Error occurred during execution of '{omitted}' process. Execution will be retried (attempt #7) in 00:00:48 seconds.\",\"Exception\":\"{omitted}\",\"Properties\":{\"ThreadId\":30}}\r\n{\"Timestamp\":\"2017-09-05T18:51:45.7243455+02:00\",\"Level\":\"Warning\",\"MessageTemplate\":\"Error occurred during execution of '{omitted}' process. Execution will be retried (attempt #8) in 00:00:52 seconds.\",\"Exception\":\"{omitted}\",\"Properties\":{\"ThreadId\":30}}\r\n{\"Timestamp\":\"2017-09-05T18:52:38.7161583+02:00\",\"Level\":\"Warning\",\"MessageTemplate\":\"Error occurred during execution of '{omitted}' process. Execution will be retried (attempt #9) in 00:01:18 seconds.\",\"Exception\":\"{omitted}\",\"Properties\":{\"ThreadId\":30}}\r\n{\"Timestamp\":\"2017-09-05T18:53:57.6934083+02:00\",\"Level\":\"Warning\",\"MessageTemplate\":\"Error occurred during execution of '{omitted}' process. Execution will be retried (attempt #10) in 00:01:40 seconds.\",\"Exception\":\"{omitted}\",\"Properties\":{\"ThreadId\":30}}\r\n{\"Timestamp\":\"2017-09-05T18:55:38.7411577+02:00\",\"Level\":\"Warning\",\"MessageTemplate\":\"Error occurred during execution of '{omitted}' process. Execution will be retried (attempt #11) in 00:01:46 seconds.\",\"Exception\":\"{omitted}\",\"Properties\":{\"ThreadId\":30}}\r\n{\"Timestamp\":\"2017-09-05T18:57:25.6628345+02:00\",\"Level\":\"Warning\",\"MessageTemplate\":\"Error occurred during execution of '{omitted}' process. Execution will be retried (attempt #12) in 00:02:15 seconds.\",\"Exception\":\"{omitted}\",\"Properties\":{\"ThreadId\":30}}\r\n{\"Timestamp\":\"2017-09-05T18:59:41.5947409+02:00\",\"Level\":\"Warning\",\"MessageTemplate\":\"Error occurred during execution of '{omitted}' process. Execution will be retried (attempt #13) in 00:02:44 seconds.\",\"Exception\":\"{omitted}\",\"Properties\":{\"ThreadId\":30}}\r\n{\"Timestamp\":\"2017-09-05T19:02:26.5768288+02:00\",\"Level\":\"Warning\",\"MessageTemplate\":\"Error occurred during execution of '{omitted}' process. Execution will be retried (attempt #14) in 00:03:10 seconds.\",\"Exception\":\"{omitted}\",\"Properties\":{\"ThreadId\":30}}\r\n{\"Timestamp\":\"2017-09-05T19:05:37.5168274+02:00\",\"Level\":\"Warning\",\"MessageTemplate\":\"Error occurred during execution of '{omitted}' process. Execution will be retried (attempt #15) in 00:03:35 seconds.\",\"Exception\":\"{omitted}\",\"Properties\":{\"ThreadId\":30}}\r\n{\"Timestamp\":\"2017-09-05T19:09:13.5148125+02:00\",\"Level\":\"Warning\",\"MessageTemplate\":\"Error occurred during execution of '{omitted}' process. Execution will be retried (attempt #16) in 00:04:08 seconds.\",\"Exception\":\"{omitted}\",\"Properties\":{\"ThreadId\":30}}\r\n{\"Timestamp\":\"2017-09-05T19:13:22.6605432+02:00\",\"Level\":\"Warning\",\"MessageTemplate\":\"Error occurred during execution of '{omitted}' process. Execution will be retried (attempt #17) in 00:04:26 seconds.\",\"Exception\":\"{omitted}\",\"Properties\":{\"ThreadId\":30}}\r\n{\"Timestamp\":\"2017-09-05T19:17:49.6799247+02:00\",\"Level\":\"Warning\",\"MessageTemplate\":\"Error occurred during execution of '{omitted}' process. Execution will be retried (attempt #18) in 00:04:53 seconds.\",\"Exception\":\"{omitted}\",\"Properties\":{\"ThreadId\":30}}\r\n{\"Timestamp\":\"2017-09-05T19:22:43.7461536+02:00\",\"Level\":\"Warning\",\"MessageTemplate\":\"Error occurred during execution of '{omitted}' process. Execution will be retried (attempt #19) in 00:05:00 seconds.\",\"Exception\":\"{omitted}\",\"Properties\":{\"ThreadId\":30}}\r\n{\"Timestamp\":\"2017-09-05T19:27:44.7892524+02:00\",\"Level\":\"Warning\",\"MessageTemplate\":\"Error occurred during execution of '{omitted}' process. Execution will be retried (attempt #20) in 00:05:00 seconds.\",\"Exception\":\"{omitted}\",\"Properties\":{\"ThreadId\":30}}\r\n{\"Timestamp\":\"2017-09-05T19:32:45.8436892+02:00\",\"Level\":\"Warning\",\"MessageTemplate\":\"Error occurred during execution of '{omitted}' process. Execution will be retried (attempt #21) in 00:05:00 seconds.\",\"Exception\":\"{omitted}\",\"Properties\":{\"ThreadId\":30}}\r\n{\"Timestamp\":\"2017-09-05T19:37:46.9866660+02:00\",\"Level\":\"Warning\",\"MessageTemplate\":\"Error occurred during execution of '{omitted}' process. Execution will be retried (attempt #22) in 00:05:00 seconds.\",\"Exception\":\"{omitted}\",\"Properties\":{\"ThreadId\":30}}\r\n{\"Timestamp\":\"2017-09-05T19:42:48.1508714+02:00\",\"Level\":\"Warning\",\"MessageTemplate\":\"Error occurred during execution of '{omitted}' process. Execution will be retried (attempt #23) in 00:05:00 seconds.\",\"Exception\":\"{omitted}\",\"Properties\":{\"ThreadId\":30}}\r\n{\"Timestamp\":\"2017-09-05T19:47:49.2822540+02:00\",\"Level\":\"Warning\",\"MessageTemplate\":\"Error occurred during execution of '{omitted}' process. Execution will be retried (attempt #24) in 00:05:00 seconds.\",\"Exception\":\"{omitted}\",\"Properties\":{\"ThreadId\":30}}\r\n```\r\n\r\nAnd it keeps going. Looks weird to me. Could it be that something got messed up with WaitAndRetry or could be that I'm doing something wrong that I can not figure it out now?\r\n\r\nI just updated to 5.3.1 and have the same result.\r\n\r\nI appreciate the help."}}
{"actor":{"display_login":"vvucetic"}}