mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-05-15 00:50:25 +02:00
cmd/cli: fix log init end marker with partial data
For partial init log data (does not end with a newline), the log writer discard data after the last newline to make the log prettier, then write the init end marker. This causes the marker could be written more than once, since the second overflows will preserve the data which does include the marker from the first write. To fix this, ensure that the init end marker is only written once, and the second overflows will preserve data until the marker instead of the fixed initial size like the first one.
This commit is contained in:
committed by
Cuong Manh Le
parent
3480043e40
commit
7444d8517a
@@ -250,7 +250,7 @@ func (p *prog) registerControlServerHandler() {
|
||||
}
|
||||
}))
|
||||
p.cs.register(sendLogsPath, http.HandlerFunc(func(w http.ResponseWriter, request *http.Request) {
|
||||
if time.Since(p.internalLogSent) < logSentInterval {
|
||||
if time.Since(p.internalLogSent) < logWriterSentInterval {
|
||||
w.WriteHeader(http.StatusServiceUnavailable)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user