sensu-plugins / sensu-plugins-slack

Sensu Slack chat handlers
http://sensu-plugins.io
MIT License
30 stars 54 forks source link

handler-slack.rb: implement a retry-timeout strategy for contacting s… #83

Closed kali-brandwatch closed 5 years ago

kali-brandwatch commented 5 years ago

…lack webhook

In certain scenarios the slack webhook delivery might fail due to several reasons:

On those cases the call to the webhook might fail and our message not get delivered, or worse, it can leave our handler hanging for too long.

This commit implements a customizable retry strategy that tries to deliver the message several times to the webhook, with a timeout to do so. It also implements a sleep time in between retries. All of these 3 settings can be customized in the json config of the handler, with defaults to 5 retries with 5 second sleeps in between, and 10 seconds timeout for each try.

This should incidentally solve issue #15

Pull Request Checklist

Is this in reference to an existing issue?

General

New Plugins

Purpose

Known Compatibility Issues

kali-brandwatch commented 5 years ago

I have added a new commit to fix the issues rubocop was complaining about but travis doesn't seem to launch a new build automatically...

kali-brandwatch commented 5 years ago

I have added a new commit to fix the issues rubocop was complaining about but travis doesn't seem to launch a new build automatically...

Sorry, it did, I was not looking properly. It seems I just missed one of rubocop's complaints.... my bad

majormoses commented 5 years ago

Sorry for the delay this fell off my radar, thanks for putting this together. I will work on cutting a release.

majormoses commented 5 years ago

released: https://rubygems.org/gems/sensu-plugins-slack/versions/4.1.0

kali-brandwatch commented 5 years ago

Thanks!