getsentry/sentry-rust

before_send_async

Opened this issue · 2 comments

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.

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

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)
});