@@ 11,14 11,17 @@ import (
"sync"
"time"
- "github.com/fsnotify/fsnotify"
vdirsyncer "git.sr.ht/~whynothugo/autovdirsyncer/vdirsyncer"
+ "github.com/fsnotify/fsnotify"
+)
+
+const (
+ passiveInterval = time.Minute * 15 // Period between automatic syncs if nothing happens.
+ activeDebounce = time.Second * 2 // Period to debounce when changes are happening.
)
var (
vdirsyncerIsRunning sync.Mutex
- passiveInterval time.Duration // Period between automatic syncs if nothing happens.
- activeDebounce time.Duration // Period to debounce when changes are happening.
)
func runSynchronization() {
@@ 115,21 118,6 @@ func addDirsToWatcher(watcher *fsnotify.Watcher, dirsToWatch []string) error {
}
func main() {
- var err error
-
- // Frequency with which updates run.
- passiveInterval, err = time.ParseDuration("15m")
- if err != nil {
- fmt.Println(err)
- os.Exit(2)
- }
-
- activeDebounce, err = time.ParseDuration("2s")
- if err != nil {
- fmt.Println(err)
- os.Exit(2)
- }
-
// Watcher that monitors for local fs changes.
watcher, err := fsnotify.NewWatcher()
if err != nil {