flightstats / hub

fault tolerant, highly available service for data storage and distribution
http://www.flightstats.com
MIT License
103 stars 35 forks source link

Regularly delete inactive webhook leaders in ZK #1119

Closed lkemmerer closed 5 years ago

lkemmerer commented 5 years ago

I restructured my commits a bit and moved up some of the refactoring I did later. I noticed a pattern where we wrap ZK curator calls in try/catch blocks and ignore errors, so that's extracted out into its own thing. It includes common actions that I noticed, some of which aren't immediately used (though I believe they're all tested).

I'd recommend looking at the PR commit-by-commit rather than all of it at once, though if it would be more digestible, I can split this into 2 PRs -- one for the first 3 commits that DRY up the ZK interactions and one for actually cleaning up inactive webhook leaders.

There's one (or maybe 2?) more PRs after this, which ensures we uniformly clean up all the ZK stuff when we delete a webhook. That PR would also include some refactoring and more thorough testing of WebhookError.