Merge pull request #12017 from nalind/exponential

Use exponential backoff when waiting for a journal entry
This commit is contained in:
OpenShift Merge Robot 2021-10-20 12:49:10 +00:00 committed by GitHub
commit 97f051f657
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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