X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/f10431fe2de1037c3c0d51d8238cecf6c1206703..55063ad6fc06f74392338802dd70cd315abf3a1a:/services/crunch-run/logging.go?ds=sidebyside diff --git a/services/crunch-run/logging.go b/services/crunch-run/logging.go index 96feb5faab..816802b708 100644 --- a/services/crunch-run/logging.go +++ b/services/crunch-run/logging.go @@ -175,7 +175,7 @@ func ReadWriteLines(in io.Reader, writer io.Writer, done chan<- bool) { // at most once per "crunchLogSecondsBetweenEvents" seconds. func NewThrottledLogger(writer io.WriteCloser) *ThrottledLogger { tl := &ThrottledLogger{} - tl.flush = make(chan struct{}) + tl.flush = make(chan struct{}, 1) tl.stopped = make(chan struct{}) tl.stopping = make(chan struct{}) tl.writer = writer @@ -261,7 +261,7 @@ func (arvlog *ArvLogWriter) Write(p []byte) (n int, err error) { } } - if (int64(arvlog.bufToFlush.Len()) > crunchLogBytesPerEvent || + if (int64(arvlog.bufToFlush.Len()) >= crunchLogBytesPerEvent || (now.Sub(arvlog.bufFlushedAt) >= crunchLogSecondsBetweenEvents) || arvlog.closing) && (arvlog.bufToFlush.Len() > 0) { // write to API