Skip to content

Commit b05bd90

Browse files
committed
Handle lock file closure errors in acquireAgentSlot function
1 parent 0daccc6 commit b05bd90

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

agent/worker.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ func acquireAgentSlot() (string, func()) {
7676
}
7777

7878
if err := lockFileExclusive(lockFile); err != nil {
79-
lockFile.Close()
79+
if cerr := lockFile.Close(); cerr != nil {
80+
logrus.WithError(cerr).Warn("failed to close lock file")
81+
}
8082
continue
8183
}
8284

@@ -99,7 +101,9 @@ func acquireAgentSlot() (string, func()) {
99101

100102
cleanup := func() {
101103
unlockFile(lockFile)
102-
lockFile.Close()
104+
if cerr := lockFile.Close(); cerr != nil {
105+
logrus.WithError(cerr).Warn("failed to close lock file")
106+
}
103107
}
104108
return uuid, cleanup
105109
}

0 commit comments

Comments
 (0)