1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2024-12-14 12:37:31 +00:00

added O_SYNC to log file opening

This commit is contained in:
postmannen 2021-04-13 13:25:44 +02:00
parent ed74b2e5a1
commit a6aa8fe4c8
2 changed files with 3 additions and 3 deletions

View file

@ -319,7 +319,7 @@ func (p process) subscriberHandler(natsConn *nats.Conn, thisNode string, msg *na
out, err = mh.handler(p, message, thisNode) out, err = mh.handler(p, message, thisNode)
if err != nil { if err != nil {
er := fmt.Errorf("error: subscriberHandler: failed to execute event: %v", err) er := fmt.Errorf("error: subscriberHandler: handler method failed: %v", err)
sendErrorLogMessage(p.toRingbufferCh, node(thisNode), er) sendErrorLogMessage(p.toRingbufferCh, node(thisNode), er)
} }
} else { } else {
@ -353,7 +353,7 @@ func (p process) subscriberHandler(natsConn *nats.Conn, thisNode string, msg *na
_, err := mf.handler(p, message, thisNode) _, err := mf.handler(p, message, thisNode)
if err != nil { if err != nil {
er := fmt.Errorf("error: subscriberHandler: failed to execute event: %v", err) er := fmt.Errorf("error: subscriberHandler: handler method failed: %v", err)
sendErrorLogMessage(p.toRingbufferCh, node(thisNode), er) sendErrorLogMessage(p.toRingbufferCh, node(thisNode), er)
} }
} else { } else {

View file

@ -454,7 +454,7 @@ func (m methodREQTextToLogFile) handler(proc process, message Message, node stri
// Open file and write data. // Open file and write data.
file := filepath.Join(folderTree, fileName) file := filepath.Join(folderTree, fileName)
f, err := os.OpenFile(file, os.O_APPEND|os.O_RDWR|os.O_CREATE, os.ModeAppend) f, err := os.OpenFile(file, os.O_APPEND|os.O_RDWR|os.O_CREATE|os.O_SYNC, os.ModeAppend)
if err != nil { if err != nil {
log.Printf("error: methodEventTextLogging.handler: failed to open file: %v\n", err) log.Printf("error: methodEventTextLogging.handler: failed to open file: %v\n", err)
return nil, err return nil, err