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

before_send_async #704

Open
alex35mil opened this issue Oct 31, 2024 · 2 comments
Open

before_send_async #704

alex35mil opened this issue Oct 31, 2024 · 2 comments

Comments

@alex35mil
Copy link

We need to do some async stuff in the before_send hook, but seems like it's not possible without using block_on. I would appreciate if you consider adding an async version of the hook or suggest another way to handle it with the current API.

@szokeasaurusrex
Copy link
Member

Hi @alex35mil, thanks for the suggestion. It will probably take us some time to get around to implementing a before_send_async function. If you would like a quicker resolution, I would suggest opening a PR

@alex35mil
Copy link
Author

Hey, @szokeasaurusrex, I tried to make it async back then and stopped when the changed api interfered with some sync integrations, such as log.

For now, we just block_in_place:

use tokio::{runtime, task};

task::block_in_place(|| {
    let runtime = runtime::Handle::current();
    runtime.block_on(future)
});

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

No branches or pull requests

2 participants