-
Notifications
You must be signed in to change notification settings - Fork 40
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
support async failpoints #73
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Xinye <[email protected]>
Signed-off-by: Xinye <[email protected]>
src/lib.rs
Outdated
match task { | ||
Task::Off => {} | ||
Task::Return(s) => return Some(s), | ||
Task::Sleep(_) => panic!( |
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 do worry this is not user friendly enough.
Maybe we can spawn a thread and send a signal after sleep some while to implement this without depending on any async runtime.
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.
Done
Signed-off-by: Xinye <[email protected]>
Seems duplicated with #58. |
From the looks of it, #58 doesn't support async sleep and runtime async callback. This PR supports them, but doesn't support specifying a compile-time async callback (the one implemented in-place with I can't figure out an elegant way to unify async and sync version of |
Signed-off-by: Xinye <[email protected]>
FYI, #58 defines two macros for sync ( |
I see, it is a slightly different mental model. Your idea is to only use async_fail_point when user want to inject async code. My idea is to always use async_fail_point in async context. In practice the latter is more versatile because we might not know what to inject beforehand. And continue with my idea, it becomes important to allow user to write |
async_fail_point
macro, it's usage is exactly the same asfail_point
, but must be placed in an asynchronous context.sleep
andpause
command sent to the async fail point will not block async runtime.cfg_async_callback
is added to inject custom async logic.Signed-off-by: Xinye [email protected]