Skip to content

Commit

Permalink
Document that polling the data_dir_lock is only required on NFS/SMB
Browse files Browse the repository at this point in the history
  • Loading branch information
carlhoerberg authored and kickster97 committed Dec 16, 2024
1 parent 9d90e03 commit 72d9257
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lavinmq/data_dir_lock.cr
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module LavinMQ
@lock.read_buffering = false
end

# See `man 2 flock`
def acquire
begin
@lock.flock_exclusive(blocking: false)
Expand All @@ -31,7 +32,7 @@ module LavinMQ
@lock.flock_unlock
end

# Read from the lock file to detect lost lock
# Read from the lock file to detect lost lock on networked filesystems (NFS/SMB)
# See "Lost locks" in `man 2 fcntl`
def poll
@lock.read_at(0, 1, &.read_byte) || raise IO::EOFError.new
Expand Down

0 comments on commit 72d9257

Please sign in to comment.