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

feat!: rs-sdk is thread safe and doesn't require &mut #1620

Merged
merged 7 commits into from
Dec 12, 2023

Conversation

lklimek
Copy link
Contributor

@lklimek lklimek commented Dec 6, 2023

Issue being fixed or feature implemented

rs-sdk should not require mutable references, as it complicates usage of the Sdk.
For example,it might require locking.

What was done?

We use Arc and lock inside Sdk whenever required.

Also some smaller refactorings implemented, for example:

  • added CancellationToken to allow cancelling of execution
  • refactored ContextProvider mock as GrpcContextProvider

How Has This Been Tested?

Breaking Changes

  • SdkBuilder::build() returns Arc
  • You need to explicitly provide ContextProvider

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

@lklimek lklimek changed the title feat: rs-sdk is thread safe and doesn't require &mut feat!: rs-sdk is thread safe and doesn't require &mut Dec 6, 2023
.github/workflows/tests.yml Outdated Show resolved Hide resolved
packages/rs-sdk/src/core_client.rs Outdated Show resolved Hide resolved
packages/rs-sdk/src/sdk.rs Show resolved Hide resolved
@shumkov
Copy link
Member

shumkov commented Dec 7, 2023

I think we should extract context logic from this PR and keep only thread safe stuff

Copy link
Member

@shumkov shumkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvement 👍

@lklimek lklimek merged commit 5cff575 into feat/register Dec 12, 2023
98 of 113 checks passed
@lklimek lklimek deleted the rs-sdk/no-mut-1 branch December 12, 2023 12:22
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.

None yet

2 participants