8311: Remove support for writable git_tree mount.
[arvados.git] / services / crunch-run / logging.go
index 96feb5faab53c8344a643054bd98605adb6ac807..0083f0999ce7f27a4c50e94729e3dbd344f89a4e 100644 (file)
@@ -1,3 +1,7 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
 package main
 
 import (
@@ -175,7 +179,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 +265,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
@@ -369,7 +373,7 @@ func (arvlog *ArvLogWriter) rateLimit(line []byte, now time.Time) (bool, []byte)
        }
 }
 
-// load the rate limit discovery config paramters
+// load the rate limit discovery config parameters
 func loadLogThrottleParams(clnt IArvadosClient) {
        param, err := clnt.Discovery("crunchLimitLogBytesPerJob")
        if err == nil {