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

Allow last error to be returned with context error #96

Merged
merged 5 commits into from
Aug 7, 2023

Conversation

willdot
Copy link
Contributor

@willdot willdot commented Aug 2, 2023

Attempts to fix #63

I came across a situation where I needed to keep trying until a context had been canceled (either through a time out or canceled).

However when doing so, the returned error was always context deadline exceeded or context canceled and I needed the error that the function I was trying to retry returned.

Obviously returning the entire error log isn't ideal since it could technically be 100s or 1000s 🤪

I am terrible at naming, so open to a better names option.

@willdot
Copy link
Contributor Author

willdot commented Aug 2, 2023

Interesting. Forgot you can't wrap more than 1 error in Go 1.19 or below.

.github/workflows/workflow.yaml Outdated Show resolved Hide resolved
@JaSei
Copy link
Collaborator

JaSei commented Aug 4, 2023

@willdot we've just released generic support #91 please resolve conflicts and I can release your PR as well.
Thanks

@willdot
Copy link
Contributor Author

willdot commented Aug 4, 2023

@willdot we've just released generic support #91 please resolve conflicts and I can release your PR as well.
Thanks

@JaSei That was one the least painful merge conflicts I've had to do 😁

@JaSei
Copy link
Collaborator

JaSei commented Aug 7, 2023

Thank you for your PR

@JaSei JaSei merged commit 8d16616 into avast:master Aug 7, 2023
JaSei added a commit that referenced this pull request Aug 7, 2023
@willdot willdot deleted the handle-context-timeout branch August 7, 2023 18:55
kodiakhq bot referenced this pull request in cloudquery/plugin-pb-go Sep 1, 2023
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/avast/retry-go/v4](https://github.com/avast/retry-go) | require | minor | `v4.3.4` -> `v4.5.0` |

---

### Release Notes

<details>
<summary>avast/retry-go (github.com/avast/retry-go/v4)</summary>

### [`v4.5.0`](https://github.com/avast/retry-go/releases/tag/v4.5.0)

[Compare Source](https://github.com/avast/retry-go/compare/4.4.0...4.5.0)

#### What's Changed

-   Allow last error to be returned with context error by [@&#8203;willdot](https://github.com/willdot) in [https://github.com/avast/retry-go/pull/96](https://github.com/avast/retry-go/pull/96)

#### New Contributors

-   [@&#8203;willdot](https://github.com/willdot) made their first contribution in [https://github.com/avast/retry-go/pull/96](https://github.com/avast/retry-go/pull/96)

**Full Changelog**: avast/retry-go@4.4.0...v4.5.0

### [`v4.4.0`](https://github.com/avast/retry-go/releases/tag/v4.4.0): (generic support)

[Compare Source](https://github.com/avast/retry-go/compare/4.3.4...4.4.0)

#### What's Changed

-   Go versions by [@&#8203;JaSei](https://github.com/JaSei) in [https://github.com/avast/retry-go/pull/97](https://github.com/avast/retry-go/pull/97)
-   fix: markdown code block format by [@&#8203;mrtc0](https://github.com/mrtc0) in [https://github.com/avast/retry-go/pull/93](https://github.com/avast/retry-go/pull/93)
-   remove error log pre-allocation and add benchmark by [@&#8203;dillonstreator](https://github.com/dillonstreator) in [https://github.com/avast/retry-go/pull/89](https://github.com/avast/retry-go/pull/89)
-   Add DoWithData function by [@&#8203;craigpastro](https://github.com/craigpastro) in [https://github.com/avast/retry-go/pull/91](https://github.com/avast/retry-go/pull/91)

#### New Contributors

-   [@&#8203;mrtc0](https://github.com/mrtc0) made their first contribution in [https://github.com/avast/retry-go/pull/93](https://github.com/avast/retry-go/pull/93)
-   [@&#8203;dillonstreator](https://github.com/dillonstreator) made their first contribution in [https://github.com/avast/retry-go/pull/89](https://github.com/avast/retry-go/pull/89)
-   [@&#8203;craigpastro](https://github.com/craigpastro) made their first contribution in [https://github.com/avast/retry-go/pull/91](https://github.com/avast/retry-go/pull/91)

**Full Changelog**: avast/retry-go@4.3.4...v4.4.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on the first day of the month" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi43OC4zIiwidXBkYXRlZEluVmVyIjoiMzYuNzguMyIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->
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.

Getting the last retry error when cancelled by context
2 participants