Skip to content

Commit

Permalink
Removed defer() in MutexConfigManager in and noticed a dramatic impro…
Browse files Browse the repository at this point in the history
…vement in performance
  • Loading branch information
thrawn01 committed Mar 28, 2016
1 parent 41b6fbe commit ac8b2a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions manager.go
Expand Up @@ -32,10 +32,9 @@ func (self *MutexConfigManager) Set(conf *Config) {

func (self *MutexConfigManager) Get() *Config {
self.mutex.Lock()
defer func() {
self.mutex.Unlock()
}()
return self.conf
temp := self.conf
self.mutex.Unlock()
return temp
}

func (self *MutexConfigManager) Close() {
Expand Down
4 changes: 2 additions & 2 deletions watcher.go
Expand Up @@ -60,8 +60,8 @@ func (self *FileWatcher) run() {
// The correct way to handle this would be to monitor the symlink instead of the
// actual file for events. However fsnotify.v1 does not allow us to pass in the
// IN_DONT_FOLLOW flag to inotify which would allow us to monitor the
// symlink for changes instead of the de-referenced file. This is likely to change
// as fsnotify is designed as cross platform and not all platforms support
// symlink for changes instead of the de-referenced file. This is not likely to
// change as fsnotify is designed as cross platform and not all platforms support
// symlinks.

if event.Op == fsnotify.Remove {
Expand Down

0 comments on commit ac8b2a8

Please sign in to comment.