Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] when http request fails, implement some retry logic #7

Closed
4 tasks
momu opened this issue Nov 25, 2023 · 0 comments · Fixed by #8
Closed
4 tasks

[feature] when http request fails, implement some retry logic #7

momu opened this issue Nov 25, 2023 · 0 comments · Fixed by #8
Assignees
Labels
enhancement New feature or request

Comments

@momu
Copy link
Owner

momu commented Nov 25, 2023

Sometimes the http request fails with status -2. In this case no http request is sent and no Divera alert is created. To prevent loosing alerts, the response code of a http request should be checked and if it is not 200 or 429 (to many request in the 5 minute interval) there should be some (definable) retries.

[15:26:06][D][binary_sensor:036]: 'DME Relais': Sending state ON
[15:26:06][I][main:1059]: Pager received a message
[15:26:06][I][main:008]: Sending Divera alert.        
[15:26:06][I][main:019]: Response status: -2, Duration: 3 ms
[15:26:07][W][http_request:087]: HTTP Request failed; URL: https://www.divera247.com/api/alarm?accesskey=<redacted>; Error: send header failed; Duration: 3 ms
[15:26:16][D][binary_sensor:036]: 'DME Relais': Sending state OFF
[15:26:37][D][binary_sensor:036]: 'DME Relais': Sending state ON
[15:26:37][I][main:1059]: Pager received a message
[15:26:38][I][main:008]: Sending Divera alert.
[15:26:40][I][main:019]: Response status: 200, Duration: 2093 ms
[15:26:40][D][http_request:099]: HTTP Request completed; URL: https://www.divera247.com/api/alarm?accesskey=<redacted>; Code: 200; Duration: 2093 ms
[15:26:40][W][component:214]: Component binary_sensor took a long time for an operation (2.12 s).
[15:26:40][W][component:215]: Components should block for at most 20-30ms.
[15:26:44][D][binary_sensor:036]: 'DME Relais': Sending state OFF

Testing

  • change the api key
  • issue a test alert
  • http response should be 403
  • check if the http request is retried N times
@momu momu self-assigned this Nov 25, 2023
@momu momu added the enhancement New feature or request label Nov 25, 2023
@momu momu linked a pull request Dec 5, 2023 that will close this issue
@momu momu closed this as completed in #8 Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant