-
Notifications
You must be signed in to change notification settings - Fork 260
Remove lock files on reboot not needed #1041
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -176,16 +176,20 @@ func (kvs *jsonFileStore) flush() error { | |
|
|
||
| // Lock locks the store for exclusive access. | ||
| func (kvs *jsonFileStore) Lock(block bool) error { | ||
| var ( | ||
| lockFile *os.File | ||
| err error | ||
| ) | ||
|
|
||
| kvs.Mutex.Lock() | ||
| defer kvs.Mutex.Unlock() | ||
|
|
||
| if kvs.locked { | ||
| return ErrStoreLocked | ||
| } | ||
|
|
||
| var lockFile *os.File | ||
| var err error | ||
| lockPerm := os.FileMode(0o664) + os.FileMode(os.ModeExclusive) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. was this value
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i corrected it to 0664 which is valid.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jsturtevant
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rbtr oops. thanks for letting me know. i will revert this back
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rbtr thanks for the explanation! |
||
| //nolint:gomnd // 0o664 - read write mode constant | ||
| lockPerm := os.FileMode(0o644) + os.FileMode(os.ModeExclusive) | ||
|
|
||
| // Try to acquire the lock file. | ||
| var lockRetryCount uint | ||
|
|
@@ -270,14 +274,6 @@ func (kvs *jsonFileStore) GetLockFileModificationTime() (time.Time, error) { | |
| kvs.Mutex.Lock() | ||
| defer kvs.Mutex.Unlock() | ||
|
|
||
| // Check if the file exists. | ||
| file, err := os.Open(kvs.lockFileName) | ||
| if err != nil { | ||
| return time.Time{}.UTC(), err | ||
| } | ||
|
|
||
| defer file.Close() | ||
|
|
||
| info, err := os.Stat(kvs.lockFileName) | ||
| if err != nil { | ||
| log.Printf("os.stat() for file %v failed: %v", kvs.lockFileName, err) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.