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 blocking client #77

Merged
merged 4 commits into from Jul 6, 2021
Merged

Add blocking client #77

merged 4 commits into from Jul 6, 2021

Conversation

Darksonn
Copy link
Collaborator

This PR adds a simple blocking Redis client.

Open questions:

  1. Does the client spawn any tasks, e.g. for periodic pings? If so, a different approach is needed.
  2. Should this be a separate crate?
  3. Should the module be called sync_client instead?

This is introduced for the purpose of being the basis for an article in the tutorial about using async code in synchronous projects.

@Darksonn Darksonn requested a review from carllerche May 19, 2021 09:57
inner: crate::client::Client,

/// A `current_thread` runtime for executing operations on the asynchronous
/// client in a blocking manner.
Copy link
Member

Choose a reason for hiding this comment

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

A short explanation of why a current_thread runtime is used here would be nice.

@carllerche
Copy link
Member

Does the client spawn any tasks, e.g. for periodic pings? If so, a different approach is needed.

It does not, but this probably should be called out in the comments. Probably the same place the current_thread discussion happens.

Should this be a separate crate?

No, this is fine.

Should the module be called sync_client instead?

Your choice :) Both seem fine to me. In tokio, we use blocking to mean block the thread when waiting, so it seems fine to stick w/ that.

@carllerche carllerche merged commit 0b3b0ff into master Jul 6, 2021
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