-
Notifications
You must be signed in to change notification settings - Fork 79
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 context and lock functionality to client interface #108
Conversation
@aleksmaus @RebeccaMahany I know you've both poked around here. How's this approach feel? |
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.
Nice!
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.
very cool way to use channels!
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!
Update: Fixed. Calling Unlock when unlocked, now panics. As it does with mutex. |
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. Thank you!
Co-authored-by: James Pickett <James-Pickett@users.noreply.github.com>
b6f784a
to
07fa160
Compare
Co-authored-by: Zach Wasserman <zach@fleetdm.com>
@zwass nudge nudge? |
@zwass @lucasmrod I'd love a thumb from y'all. Mostly because I don't want to inadvertently break what you're doing. I think there's enough support for this, so I'm going to end up merging it. But I do want to give y'all time to object / approve / etc |
Hearing no objections and tentative approval, I'm going to merge this. |
Yes that makes sense. I don't think this will cause any issues for us. Thanks! |
As discussed in #98, the osquery thrift socket is can only handle a single caller.
In #99, I tried adding a mutex. But, with a mutex, it didn't feel like there was a good timeout behavior. Looking round, I considered a
rate.Limiter
, but I find those very hard to understand. And eventually I found this suggestion for using single sized channels as a form of mutex.This should allow for exclusive locking, timeouts, and ctx cancelation.
I have also stopped exporting the raw osquery thrift client. Using it would bypass these locks, and feels like an antipattern. However, it does make this a breaking change.
I also bumped the go version because CI was complaining
Fixes: #98
Closes: #99