stmcginnis / gofish

Gofish is a Golang client library for DMTF Redfish and SNIA Swordfish interaction.
BSD 3-Clause "New" or "Revised" License
224 stars 117 forks source link

Add workaround to ZT systems rate limit bug. #192

Closed nwaizer closed 2 years ago

stmcginnis commented 2 years ago

Thanks, but pulling in all of apimachinery is pretty heavy wait for this. Is there another library that can give the functionality you need without doing that? Gofish dependencies should be kept very minimal.

nwaizer commented 2 years ago

may I use github.com/avast/retry-go ?

stmcginnis commented 2 years ago

The retry needs are pretty basic, so it really would be best to just put in a retry loop and not bring in a whole library just to do it. Something along the lines of:

for i := 0; i < retryAttempts; i++ {
    resp, err = eventservice.Client.Post(eventservice.SubmitTestEventTarget, p)
    if err == nil {
        break
    }

    log.Printf("Failed to send test event (%d/%d)\n", i+1, retryAttempts)
    time.Sleep(retryInterval)
}

if err != nil {
    return err
}
nwaizer commented 2 years ago

Done