Skip to content

Commit 1c1e166

Browse files
committed
rename to cacheLock
1 parent 5c73c70 commit 1c1e166

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

cmd/daemon/main.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ type Config struct {
373373

374374
// We need to keep this object around, otherwise it gets GC'd and the
375375
// finalizer will run, probably closing the lock.
376-
configLock *flock.Flock
376+
cacheLock *flock.Flock
377377

378378
LogLevel log.Level `koanf:"log_level"`
379379
LogDisableTimestamp bool `koanf:"log_disable_timestamp"`
@@ -461,18 +461,18 @@ func loadConfig(cfg *Config) error {
461461
return err
462462
}
463463

464-
// Make config directory if needed.
464+
// Make cache directory if needed.
465465
err = os.MkdirAll(cfg.CacheDir, 0o700)
466466
if err != nil {
467-
return fmt.Errorf("failed creating config directory: %w", err)
467+
return fmt.Errorf("failed creating cache directory: %w", err)
468468
}
469469

470-
// Lock the config directory (to ensure multiple instances won't clobber
470+
// Lock the cache directory (to ensure multiple instances won't clobber
471471
// each others state).
472472
lockFilePath := filepath.Join(cfg.CacheDir, "lockfile")
473-
cfg.configLock = flock.New(lockFilePath)
474-
if locked, err := cfg.configLock.TryLock(); err != nil {
475-
return fmt.Errorf("could not lock config directory: %w", err)
473+
cfg.cacheLock = flock.New(lockFilePath)
474+
if locked, err := cfg.cacheLock.TryLock(); err != nil {
475+
return fmt.Errorf("could not lock cache directory: %w", err)
476476
} else if !locked {
477477
// Lock already taken! Looks like go-librespot is already running.
478478
return fmt.Errorf("%w (lockfile: %s)", errAlreadyRunning, lockFilePath)

0 commit comments

Comments
 (0)