aboutsummaryrefslogtreecommitdiff
path: root/azalea/examples/testbot.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2023-11-18 02:24:34 -0600
committermat <git@matdoes.dev>2023-11-18 02:24:34 -0600
commit8d0acecdcfa49a5cc25d1c201fab8601a692b5e5 (patch)
tree266494d7f9a40d1e78947fffe712090ce6da8084 /azalea/examples/testbot.rs
parent89f5053b475b23bbd5b6316b189aea575f689ded (diff)
downloadazalea-drasl-8d0acecdcfa49a5cc25d1c201fab8601a692b5e5.tar.xz
fix memory leak when loading chunks in swarms
Diffstat (limited to 'azalea/examples/testbot.rs')
-rw-r--r--azalea/examples/testbot.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/azalea/examples/testbot.rs b/azalea/examples/testbot.rs
index 38f8d499..c47aa061 100644
--- a/azalea/examples/testbot.rs
+++ b/azalea/examples/testbot.rs
@@ -56,7 +56,7 @@ async fn main() -> anyhow::Result<()> {
.add_accounts(accounts.clone())
.set_handler(handle)
.set_swarm_handler(swarm_handle)
- .join_delay(Duration::from_millis(1000))
+ .join_delay(Duration::from_millis(100))
.start("localhost")
.await;
// let e = azalea::ClientBuilder::new()
@@ -154,6 +154,11 @@ async fn handle(mut bot: Client, event: Event, _state: State) -> anyhow::Result<
"lag" => {
std::thread::sleep(Duration::from_millis(1000));
}
+ "quit" => {
+ bot.disconnect();
+ tokio::time::sleep(Duration::from_millis(1000)).await;
+ std::process::exit(0);
+ }
"inventory" => {
println!("inventory: {:?}", bot.menu());
}