diff options
| author | mat <git@matdoes.dev> | 2026-01-06 06:34:19 -0500 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2026-01-06 06:34:19 -0500 |
| commit | fdbcfaab4813da928f9f27e119d4951088c3a853 (patch) | |
| tree | 19f33692f882ada386f8b6aea1e1a195a905e286 /azalea/README.md | |
| parent | 9c2c7c3497a74e80d7186fdcd97ce2518520faa6 (diff) | |
| download | azalea-drasl-fdbcfaab4813da928f9f27e119d4951088c3a853.tar.xz | |
add a few more convenience functions and update some docs
Diffstat (limited to 'azalea/README.md')
| -rw-r--r-- | azalea/README.md | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/azalea/README.md b/azalea/README.md index 8a02e7da..eb066839 100644 --- a/azalea/README.md +++ b/azalea/README.md @@ -119,7 +119,7 @@ Backtraces are also useful, though they're sometimes hard to read and don't alwa ## Using `tokio::task::spawn_local` instead of `tokio::spawn` -If you spawn a task with `tokio::spawn` and move your bot into it, it's possible for Tokio to run the handler function or schedule a Minecraft tick at an unexpected moment. For instance, `bot.component::<TicksConnected>() == bot.component::<TicksConnected>()` is not guaranteed to be true inside of a `tokio::spawn`. Azalea already mitigates this in the handler function by using a Tokio [LocalSet](https://docs.rs/tokio/latest/tokio/task/struct.LocalSet.html), but that mitigation does not apply if you call `tokio::spawn` yourself. To avoid this, you must call `tokio::task::spawn_local` in place of `tokio::spawn`. Alternatively, you could also mark your main function with `#[tokio::main(flavor = "current_thread")]`. +If you spawn a task with `tokio::spawn` and move your bot into it, it's possible for Tokio to run the handler function or schedule a Minecraft tick at an unexpected moment. For instance, `bot.ticks_connected() == bot.ticks_connected()` is not guaranteed to be true inside of a `tokio::spawn`. Azalea already mitigates this in the handler function by using a Tokio [LocalSet](https://docs.rs/tokio/latest/tokio/task/struct.LocalSet.html), but that mitigation does not apply if you call `tokio::spawn` yourself. To avoid this, you must call `tokio::task::spawn_local` in place of `tokio::spawn`. Alternatively, you could also mark your main function with `#[tokio::main(flavor = "current_thread")]`. ## Disabling log messages |
