mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-11-30 17:42:32 +01:00
Contract-Neutral: monitor construction only moves alerts-owned durable-store initialization before alert workers; monitoring and host-agent behavior are unchanged
28 lines
594 B
Go
28 lines
594 B
Go
//go:build !windows
|
|
|
|
package alerts
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
func syncActiveAlertsDirectory(path string) error {
|
|
dirHandle, err := os.Open(path)
|
|
if err != nil {
|
|
return fmt.Errorf("failed to open alerts directory for sync: %w", err)
|
|
}
|
|
if err := dirHandle.Sync(); err != nil {
|
|
_ = dirHandle.Close()
|
|
return fmt.Errorf("failed to sync alerts directory: %w", err)
|
|
}
|
|
if err := dirHandle.Close(); err != nil {
|
|
return fmt.Errorf("failed to close alerts directory after sync: %w", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func replaceActiveAlertsFile(from, to string) error {
|
|
return os.Rename(from, to)
|
|
}
|