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

Add -wait parameter to debounce watched events #156

Merged
merged 1 commit into from
Jan 26, 2016

Conversation

gigablah
Copy link
Contributor

Addresses the following issues: #42, #43, #57, #103, #136

This is a rewrite of generateFromEvents that makes the following changes:

  • Only configs that have watch = true will be generated upon container events.
  • All configs will be regenerated when the events channel is reattached, rather than upon docker client re-initialization. (avoids missing out on events in between)
  • Each config with watch now has its own separate channel. This is to enable individual debouncing parameters, specified with the wait parameter. Syntax is min:max, e.g. 500ms:2s. This feature is referenced from hashicorp/envconsul

I've also added an integration test for generator.go that verifies the wait parameter :)

@gigablah
Copy link
Contributor Author

A few more changes:

  • I made generateAtInterval and generateFromEvents aware of termination signals as well (replaced an apparently unused quit channel in generateAtInterval in the process)
  • Made the docker daemon reconnection logic more robust, so now it will survive a docker restart
  • Also added an internal retry flag for the generator which determines if it will attempt to reconnect if the events channel is closed, mainly for testing purposes.

@jgallen23
Copy link

this is awesome! This solves all my issues and would let me safely run docker-gen in prod and give me nearly zero-downtime deployments

jwilder added a commit that referenced this pull request Jan 26, 2016
Add -wait parameter to debounce watched events
@jwilder jwilder merged commit f59341e into nginx-proxy:master Jan 26, 2016
@jwilder
Copy link
Collaborator

jwilder commented Jan 26, 2016

Nice @gigablah! Thanks!

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.

3 participants