Add a note about not calling sync for persistCheckState

This commit is contained in:
Kyle Havlovitz 2016-11-07 15:24:31 -05:00
parent e30b289c6f
commit 7a3e0f8275
No known key found for this signature in database
GPG Key ID: 836A4D58766E5793
1 changed files with 1 additions and 0 deletions

View File

@ -1100,6 +1100,7 @@ func (a *Agent) persistCheckState(check *CheckTTL, status, output string) error
// Create temp file in same dir, to make more likely atomic // Create temp file in same dir, to make more likely atomic
tempFile := file + ".tmp" tempFile := file + ".tmp"
// persistCheckState is called frequently, so don't use writeFileAtomic to avoid calling fsync here
if err := ioutil.WriteFile(tempFile, buf, 0600); err != nil { if err := ioutil.WriteFile(tempFile, buf, 0600); err != nil {
return fmt.Errorf("failed writing temp file %q: %s", tempFile, err) return fmt.Errorf("failed writing temp file %q: %s", tempFile, err)
} }