diff options
author | Nalin Dahyabhai <nalin@redhat.com> | 2021-10-18 12:29:12 -0400 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2021-11-12 11:08:25 -0500 |
commit | 465e27cf10d1019297dfed643ed22d3d558a00da (patch) | |
tree | c518ac105deada8b10e49500aa5adf049bfb9494 /libpod | |
parent | 3b67336b608efd72a0e7a023b85b1b3dc2dc4746 (diff) | |
download | podman-465e27cf10d1019297dfed643ed22d3d558a00da.tar.gz podman-465e27cf10d1019297dfed643ed22d3d558a00da.tar.bz2 podman-465e27cf10d1019297dfed643ed22d3d558a00da.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 |