Fixes Issues #182 - Broken config file watching. #184

Merged
merged 1 commit into from Nov 10, 2012

2 participants

@ciaranj

Implements fix as suggested by Peter Schuster in comment thread.

Signed-off-by: ciaranj ciaranj@gmail.com

@mrtazz mrtazz and 2 others commented on an outdated diff Nov 2, 2012
lib/config.js
@@ -21,8 +21,8 @@ var Configurator = function (file) {
this.updateConfig();
- fs.watch(file, function (curr, prev) {
- if (curr.ino != prev.ino) { self.updateConfig(); }
+ fs.watch(file, function (event, filename) {
+ if (event != 'rename') { self.updateConfig(); }
@mrtazz
Etsy, Inc. member
mrtazz added a line comment Nov 2, 2012

is there a reason why we test for != 'rename' and not just == 'change'? Judging from the docs only those two events are available and checking for the actual one we want might be more clear.

@ciaranj
ciaranj added a line comment Nov 2, 2012

True, I just cut'n'pasted the suggested patch to get a pull request in as this is so broken at the minute. Would you prefer it this way around ?

@peschuster
peschuster added a line comment Nov 2, 2012

My thought was that 'rename' is clearly no change in content, so we can exclude it. But in case there will be more event types in the future (no idea what this could be), it won't harm to reload the config. With a condition on 'change' we would miss these. But at the moment it would not make any difference.

@mrtazz
Etsy, Inc. member
mrtazz added a line comment Nov 3, 2012
@peschuster
peschuster added a line comment Nov 3, 2012

I'm totally fine with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ciaranj

So, just to confirm I swap to == 'change' and we're good to merge?

@mrtazz
Etsy, Inc. member

yup

@ciaranj

Doneski ;)

@ciaranj ciaranj Fixes Issues #182 - Broken config file watching.
Implements fix as suggested by Peter Schuster and Daniel
Schauenberg in comment thread.

Signed-off-by: ciaranj <ciaranj@gmail.com>
ad011af
@mrtazz
Etsy, Inc. member

awesome! thanks for the patch.

@mrtazz mrtazz merged commit 5a4609f into etsy:master Nov 10, 2012

1 check passed

Details default The Travis build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment