refactor: use nginx -s reload instead of systemd
- doc: add comment
This commit is contained in:
@@ -15,7 +15,9 @@ import (
|
||||
// Lock 持有与文件描述符绑定的 Linux advisory flock。
|
||||
// 锁文件可以永久存在;只有内核锁状态表示当前所有权。
|
||||
type Lock struct {
|
||||
mu sync.Mutex
|
||||
// mu 保证释放操作与状态访问的并发安全。
|
||||
mu sync.Mutex
|
||||
// file 与内核锁绑定的锁文件描述符。
|
||||
file *os.File
|
||||
}
|
||||
|
||||
@@ -50,6 +52,7 @@ func Acquire(path string) (*Lock, error) {
|
||||
return &Lock{file: file}, nil
|
||||
}
|
||||
|
||||
// writeOwnerPID 将当前进程 PID 写入锁文件并落盘,供诊断排查。
|
||||
func writeOwnerPID(file *os.File) error {
|
||||
if err := file.Truncate(0); err != nil {
|
||||
return fmt.Errorf("truncate process lock metadata: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user