mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
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>
This commit is contained in:
@ -91,8 +91,12 @@ func (c *Container) readFromJournal(ctx context.Context, options *logs.LogOption
|
|||||||
var cursorError error
|
var cursorError error
|
||||||
for i := 1; i <= 3; i++ {
|
for i := 1; i <= 3; i++ {
|
||||||
cursor, cursorError = journal.GetCursor()
|
cursor, cursorError = journal.GetCursor()
|
||||||
|
hundreds := 1
|
||||||
|
for j := 1; j < i; j++ {
|
||||||
|
hundreds *= 2
|
||||||
|
}
|
||||||
if cursorError != nil {
|
if cursorError != nil {
|
||||||
time.Sleep(time.Duration(i*100) * time.Millisecond)
|
time.Sleep(time.Duration(hundreds*100) * time.Millisecond)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
Reference in New Issue
Block a user