diff options
author | Nalin Dahyabhai <nalin@redhat.com> | 2021-10-18 12:29:12 -0400 |
---|---|---|
committer | Nalin Dahyabhai <nalin@redhat.com> | 2021-10-18 14:16:09 -0400 |
commit | db7a98de40629b958d8867c36cf6f4998d335213 (patch) | |
tree | 79a9499da2e7f70310edc3237b18da489594d392 /libpod | |
parent | e0ffc431fe7f016124fdcb36819698a90fe448a9 (diff) | |
download | podman-db7a98de40629b958d8867c36cf6f4998d335213.tar.gz podman-db7a98de40629b958d8867c36cf6f4998d335213.tar.bz2 podman-db7a98de40629b958d8867c36cf6f4998d335213.zip |
Use exponential backoff when waiting for a journal entry
When looking for a cursor that matches the first journal entry for a
given container, wait and try to find it using exponential backoff.
[NO NEW TESTS NEEDED]
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container_log_linux.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libpod/container_log_linux.go b/libpod/container_log_linux.go index ca1e11ef5..562169ce2 100644 --- a/libpod/container_log_linux.go +++ b/libpod/container_log_linux.go @@ -91,8 +91,12 @@ func (c *Container) readFromJournal(ctx context.Context, options *logs.LogOption var cursorError error for i := 1; i <= 3; i++ { cursor, cursorError = journal.GetCursor() + hundreds := 1 + for j := 1; j < i; j++ { + hundreds *= 2 + } if cursorError != nil { - time.Sleep(time.Duration(i*100) * time.Millisecond) + time.Sleep(time.Duration(hundreds*100) * time.Millisecond) continue } break |