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

clients: request ID as RAII guard #543

Merged
merged 6 commits into from
Nov 5, 2021
Merged

clients: request ID as RAII guard #543

merged 6 commits into from
Nov 5, 2021

Conversation

niklasad1
Copy link
Member

The rationale behind this change is to reduce the technical debt, not to require us to remember to reclaim a request ID when a request was completed successful or not.

.map(|_| ())
.map_err(|_| Error::MaxSlotsExceeded)
fn get_slot(&self) -> Result<Arc<()>, Error> {
// Strong count is 1 at start, so that's why we use `>` and not `>=`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Useful comment, thank you!

types/src/client.rs Outdated Show resolved Hide resolved
_rc: Arc<()>,
}

impl<T> RequestId<T> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess this could be a Deref impl too, but given how it's used I wouldn't mind either way!

Copy link
Collaborator

@jsdw jsdw left a comment

Choose a reason for hiding this comment

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

LGTM!

@niklasad1 niklasad1 merged commit 32d2925 into master Nov 5, 2021
@niklasad1 niklasad1 deleted the na-refactor-id-guard branch November 5, 2021 16:15
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.

3 participants