-
Notifications
You must be signed in to change notification settings - Fork 173
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
Conversation
.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 `>=`. |
There was a problem hiding this comment.
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
_rc: Arc<()>, | ||
} | ||
|
||
impl<T> RequestId<T> { |
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
`RequestIdGuard` -> `RequestIdManager` `RequestId` -> `RequestIdGuard`
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.