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

Use a unified Context for ZetaClient #1160

Closed
lumtis opened this issue Sep 20, 2023 · 3 comments
Closed

Use a unified Context for ZetaClient #1160

lumtis opened this issue Sep 20, 2023 · 3 comments
Assignees
Labels
zetaclient Issues related to ZetaClient

Comments

@lumtis
Copy link
Member

lumtis commented Sep 20, 2023

We use context.Background and context.TODO throughout the code.

This might become a problem if a Go routine need to be canceled when another is canceled, or if ZetaClient is incorporated in another package.

It is also in general proper to determine determine a unified context that is used in the package.

Solution:

  • Add a context object Ctx as a field of the different object: CoreObserver, ZetaCoreBridge, Signer, etc...
  • Replace context.Background with these values
  • Initialize with context.Background the root context
@lumtis lumtis added the zetaclient Issues related to ZetaClient label Sep 20, 2023
@swift1337 swift1337 self-assigned this Jun 27, 2024
@swift1337
Copy link
Contributor

I think the root cause of the issue is that currently we don't pass ctx context.Context as the first argument to all functions that do i/o / networking / etc. I'll take care of this

@lumtis
Copy link
Member Author

lumtis commented Jun 28, 2024

I think the root cause of the issue is that currently we don't pass ctx context.Context as the first argument to all functions that do i/o / networking / etc. I'll take care of this

Sounds good

@lumtis
Copy link
Member Author

lumtis commented Jul 18, 2024

Closed by #2428

@lumtis lumtis closed this as completed Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
zetaclient Issues related to ZetaClient
Projects
None yet
Development

No branches or pull requests

2 participants