andreaskoch / go-fswatch

fswatch is a go library for monitoring filesystem changes that does not depend on inotify
Other
57 stars 9 forks source link

FolderWatcher uses checkIntervalInSeconds as nanoseconds #7

Closed djablonski closed 1 year ago

djablonski commented 1 year ago

Maybe I'm just dumb, but my debugger brought to my attention that the checkInterval that I'm using (assumed to tbe 1s) is in reality 1ns. Checking the code, I found that the int parameter checkIntervalInSeconds in NewFolderWatcher is used unchanged to initalize a time.Duration here. This leads to a duration in nanoseconds. Same issue also applies to NewFileWatcher here

djablonski commented 1 year ago

PR #8 should fix this

djablonski commented 1 year ago

Okay, now I found the place where the transformation from nanoseconds to seconds is done. Still, the code is confusing here, as the duration is still in nanoseconds with the value of checkIntervalInSeconds until finally used un the Start() function.