{"action":"created","issue":{"url":"https://api.github.com/repos/smallrye/smallrye-fault-tolerance/issues/28","repository_url":"https://api.github.com/repos/smallrye/smallrye-fault-tolerance","labels_url":"https://api.github.com/repos/smallrye/smallrye-fault-tolerance/issues/28/labels{/name}","comments_url":"https://api.github.com/repos/smallrye/smallrye-fault-tolerance/issues/28/comments","events_url":"https://api.github.com/repos/smallrye/smallrye-fault-tolerance/issues/28/events","html_url":"https://github.com/smallrye/smallrye-fault-tolerance/issues/28","id":373952600,"node_id":"MDU6SXNzdWUzNzM5NTI2MDA=","number":28,"title":"Circuitbreaker not opening with certain parameters with fallback method","user":{"login":"dvddhln","id":2706002,"node_id":"MDQ6VXNlcjI3MDYwMDI=","avatar_url":"https://avatars0.githubusercontent.com/u/2706002?v=4","gravatar_id":"","url":"https://api.github.com/users/dvddhln","html_url":"https://github.com/dvddhln","followers_url":"https://api.github.com/users/dvddhln/followers","following_url":"https://api.github.com/users/dvddhln/following{/other_user}","gists_url":"https://api.github.com/users/dvddhln/gists{/gist_id}","starred_url":"https://api.github.com/users/dvddhln/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dvddhln/subscriptions","organizations_url":"https://api.github.com/users/dvddhln/orgs","repos_url":"https://api.github.com/users/dvddhln/repos","events_url":"https://api.github.com/users/dvddhln/events{/privacy}","received_events_url":"https://api.github.com/users/dvddhln/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-10-25T13:39:39Z","updated_at":"2018-11-19T15:53:40Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\nI am trying to use the `CircuitBreaker` annotation with following parameters\r\n```\r\n@Fallback(fallbackMethod = \"handleLoginFailure\")\r\n@CircuitBreaker(successThreshold = 1,requestVolumeThreshold = 2, failureRatio = 0.5,\r\ndelay = 15, failOn = {Exception.class}, delayUnit = ChronoUnit.SECONDS)\r\n```\r\nI make two sucessfull requests as expected and then it breaks as expected on the first unsuccessful request, but the subsequent request passes through as if it was closed. Am I missing something in the configuration or is this expected behaviour? Should'nt the delay be active now and the fallback method should be handling the subsequent requests during the duration of the delay?\r\n\r\n/David"},"comment":{"url":"https://api.github.com/repos/smallrye/smallrye-fault-tolerance/issues/comments/439941587","html_url":"https://github.com/smallrye/smallrye-fault-tolerance/issues/28#issuecomment-439941587","issue_url":"https://api.github.com/repos/smallrye/smallrye-fault-tolerance/issues/28","id":439941587,"node_id":"MDEyOklzc3VlQ29tbWVudDQzOTk0MTU4Nw==","user":{"login":"mkouba","id":913004,"node_id":"MDQ6VXNlcjkxMzAwNA==","avatar_url":"https://avatars1.githubusercontent.com/u/913004?v=4","gravatar_id":"","url":"https://api.github.com/users/mkouba","html_url":"https://github.com/mkouba","followers_url":"https://api.github.com/users/mkouba/followers","following_url":"https://api.github.com/users/mkouba/following{/other_user}","gists_url":"https://api.github.com/users/mkouba/gists{/gist_id}","starred_url":"https://api.github.com/users/mkouba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkouba/subscriptions","organizations_url":"https://api.github.com/users/mkouba/orgs","repos_url":"https://api.github.com/users/mkouba/repos","events_url":"https://api.github.com/users/mkouba/events{/privacy}","received_events_url":"https://api.github.com/users/mkouba/received_events","type":"User","site_admin":false},"created_at":"2018-11-19T15:53:40Z","updated_at":"2018-11-19T15:53:40Z","author_association":"CONTRIBUTOR","body":"Ok, so I think that the test is wrong. The FT operation is defined like this:  \r\n```java\r\n @Fallback(fallbackMethod = \"operationFailure\")\r\n @CircuitBreaker(successThreshold = 1, requestVolumeThreshold = 2, failureRatio = 0.5, delay = 15, failOn = {RuntimeException.class}, delayUnit = ChronoUnit.SECONDS)\r\n  public String operation() { }\r\n```\r\nBut the `TestCircuit` only makes 4 requests. First two are OK. Then one fails - but the circuit breaker is not open yet as it waits for the next request to pass the threshold defined in `requestVolumeThreshold`.\r\n\r\nIf you change the code to something like:\r\n```java\r\n @Fallback(fallbackMethod = \"operationFailure\")\r\n @CircuitBreaker(successThreshold = 1, requestVolumeThreshold = 3, failureRatio = 0.3, delay = 15, failOn = {RuntimeException.class}, delayUnit = ChronoUnit.SECONDS)\r\n  public String operation() { }\r\n```\r\nThe test passes because `testGetWithFailureFirstExpectedFallback()` closes the circuit breaker."}}
{"actor":{"display_login":"mkouba"}}