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

Support context.Context #56

Open
benny-conn opened this issue May 10, 2023 · 1 comment · May be fixed by #70
Open

Support context.Context #56

benny-conn opened this issue May 10, 2023 · 1 comment · May be fixed by #70

Comments

@benny-conn
Copy link

benny-conn commented May 10, 2023

I wish I could use this library but because it does not support go's context.Context I can't reliably use it. This library obviously performs operations over a network and it is common practice to use a context so that network operations can be cancelled by the context, either by manual cancellation or deadline. The go http package supports contexts with functions like http.NewRequestWithContext.

Even if I use contexts and goroutines to disregard the response of a *goar.Client when a context times out for example, there is no way to stop the execution of a function. If I were to be downloading content from arweave, it would continue downloading despite the context cancelling, and the program continuing running.

The only workaround I can see is manually setting a timeout on the http client, but this is bad practice and not predictable.

@zyjblockchain
Copy link
Member

Hello yes, we support ctx on post data on arweave, but not support download data from arweave.
it is so easy if support this, if you have enough time, and you can try to implement it and submit a pr. I would be very grateful.

Laisky added a commit to Laisky/goar that referenced this issue May 20, 2024
closes everFinance#56

Here is the commit message:

**Summary**

This commit adds support for context parameters to various functions across the codebase, enabling cancellation of long-running operations and improving error handling.

**Key Changes**

- Added context support to various functions, such as `GetTransactionData`, `BroadcastData`, `Send*`, and `WarpTransfer`, allowing for cancellation and improved error handling.
- Updated multiple files to use the `context` package and its functions.
- Modified several functions to take a `context.Context` as an argument, enabling cancellation and better error handling.
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 a pull request may close this issue.

2 participants