Skip to content

Commit 00ab4dd

Browse files
committed
rename to cacheLock
1 parent f2f73f1 commit 00ab4dd

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

cmd/daemon/main.go

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

369369
// We need to keep this object around, otherwise it gets GC'd and the
370370
// finalizer will run, probably closing the lock.
371-
configLock *flock.Flock
371+
cacheLock *flock.Flock
372372

373373
LogLevel log.Level `koanf:"log_level"`
374374
DeviceId string `koanf:"device_id"`
@@ -455,18 +455,18 @@ func loadConfig(cfg *Config) error {
455455
return err
456456
}
457457

458-
// Make config directory if needed.
458+
// Make cache directory if needed.
459459
err = os.MkdirAll(cfg.CacheDir, 0o700)
460460
if err != nil {
461-
return fmt.Errorf("failed creating config directory: %w", err)
461+
return fmt.Errorf("failed creating cache directory: %w", err)
462462
}
463463

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

0 commit comments

Comments
 (0)