Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workaround to ZT systems rate limit bug. #192

Merged
merged 1 commit into from
Aug 20, 2022

Conversation

nwaizer
Copy link
Contributor

@nwaizer nwaizer commented Aug 3, 2022

No description provided.

@nwaizer nwaizer force-pushed the ZT_retry_send_event branch from 78cdf4b to d36c1fc Compare August 3, 2022 21:38
@stmcginnis
Copy link
Owner

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
Copy link
Contributor Author

nwaizer commented Aug 3, 2022

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

@nwaizer nwaizer force-pushed the ZT_retry_send_event branch from d36c1fc to 7da8e2a Compare August 3, 2022 21:57
@stmcginnis
Copy link
Owner

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 nwaizer force-pushed the ZT_retry_send_event branch from 7da8e2a to 0fe2c91 Compare August 4, 2022 09:29
@nwaizer
Copy link
Contributor Author

nwaizer commented Aug 4, 2022

Done

@nwaizer nwaizer force-pushed the ZT_retry_send_event branch 2 times, most recently from efafbff to 7b4a692 Compare August 4, 2022 10:25
go.mod Outdated Show resolved Hide resolved
oem/zt/eventservice.go Outdated Show resolved Hide resolved
@nwaizer nwaizer force-pushed the ZT_retry_send_event branch from 7b4a692 to 85ba0f0 Compare August 7, 2022 08:03
@stmcginnis stmcginnis force-pushed the ZT_retry_send_event branch from 85ba0f0 to bfecb06 Compare August 20, 2022 12:24
@stmcginnis stmcginnis merged commit 421a112 into stmcginnis:main Aug 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants