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

Hot config reload, part 2 + refactor backends structure #33

Merged
merged 33 commits into from
Jan 16, 2017

Conversation

flashmob
Copy link
Owner

This will fix #18
WIP

… the default

* removed unused 'verbose' variable
* guerrilla struct now holds servers as a map instead of slice
* API change: guerrilla.New() now returns error
* Refactor TLS config into a separate function
* server's serverConfig is now kept in an atomic value, ready for hot config reload
* Slightly raised the hard limit on DATA state, to avoid potential errors
* Refactored allowedHosts to use a map for lookup instead of doing O(n)
* removed case statement in serve.go to make backends dynamically loaded
* Structual changes so that that backends support worker pools & can re-use code.
- Future groundwork for decorator pattern
* simplify (remove helper)
* pass saveMailChan via function instead of embedding (simplify)
going to save decorator pattern for another day, needs more thinking
- emit config change events on config file changes when SIGHUP gets caught
- config tests, including events and sample config
@flashmob flashmob changed the title Hot config reload, part 2 Hot config reload, part 2 + refactor backends structure Jan 6, 2017
…ts yet)

- fix server would hang on Accept error
* Start() and New() return the new Errors type
* Behavior change of serve: does not exit if servers could not be started
* Tests for server_change:start_server fired when server was enabled after reloading config - TestServerStartEvent
* Backend proxy: added states & shutdown is protected by mutex
* Behaviour change: sigHandler will return rather than exit on kill / sigterm signals
* Backend errors: revert to return error as error rather than custom type...
…ill keep their own table in a map, which may be customized in the future.

- "allowed hosts" now supports config reload event, will reload for all servers when SIGHUP is caught.
Tightened up locking to the active clients map  and eliminated some  statements
…Guerrilla interface. This should make the event bus easy to swap out should it be changed to a different implementation. Users of the API can also have easier access to the server events

All tests have been updated accordingly.
@flashmob flashmob merged commit 2c30290 into master Jan 16, 2017
@flashmob flashmob deleted the hot-config-reload branch January 16, 2017 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Config reloading feature
1 participant