diff options
| author | chrislu <chris.lu@gmail.com> | 2024-04-25 23:42:19 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2024-04-25 23:42:19 -0700 |
| commit | 8948fb51e363bf1011fb754cddd98038bce682cb (patch) | |
| tree | 1cf6d1d65f126a07ed685b39835f1611ec427161 /weed/util | |
| parent | 63036133ffa04efc95f8751435ef6b80711c6657 (diff) | |
| parent | abf01a0eb724aa82a5b2465c1dbde67bcc795727 (diff) | |
| download | seaweedfs-8948fb51e363bf1011fb754cddd98038bce682cb.tar.xz seaweedfs-8948fb51e363bf1011fb754cddd98038bce682cb.zip | |
Merge branch 'master' into mq-subscribe
Diffstat (limited to 'weed/util')
| -rw-r--r-- | weed/util/http_util.go | 2 | ||||
| -rw-r--r-- | weed/util/log_buffer/log_read.go | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/weed/util/http_util.go b/weed/util/http_util.go index 7b3ac4bc4..6f6a17008 100644 --- a/weed/util/http_util.go +++ b/weed/util/http_util.go @@ -328,7 +328,7 @@ func ReadUrlAsStreamAuthenticated(fileUrl, jwt string, cipherKey []byte, isConte } defer CloseResponse(r) if r.StatusCode >= 400 { - retryable = r.StatusCode == http.StatusNotFound || r.StatusCode >= 500 + retryable = r.StatusCode == http.StatusNotFound || r.StatusCode >= 499 return retryable, fmt.Errorf("%s: %s", fileUrl, r.Status) } diff --git a/weed/util/log_buffer/log_read.go b/weed/util/log_buffer/log_read.go index c3dd0f288..0d044fc14 100644 --- a/weed/util/log_buffer/log_read.go +++ b/weed/util/log_buffer/log_read.go @@ -66,9 +66,17 @@ func (logBuffer *LogBuffer) LoopProcessLogData(readerName string, startPosition isDone = true return } + logBuffer.RLock() lastTsNs := logBuffer.LastTsNs - for lastTsNs == logBuffer.LastTsNs { + logBuffer.RUnlock() + loopTsNs := lastTsNs // make a copy + + for lastTsNs == loopTsNs { if waitForDataFn() { + // Update loopTsNs and loop again + logBuffer.RLock() + loopTsNs = logBuffer.LastTsNs + logBuffer.RUnlock() continue } else { isDone = true |
