You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am trying to use AsyncScheduler within my project and I was just wondering if there were any better or more ergonomic ways of doing this? I struggled a lot getting the state shared, but somehow got that working. Any tips or tricks greatly appreciated.
pubasyncfnscheduler_init(state:Arc<State>){letmut scheduler = AsyncScheduler::new();// Refactor these blocks into add functionlet shared_state = Arc::clone(&state);
scheduler.every(60.seconds()).run(move || {let shared_state = Arc::clone(&shared_state);asyncmove{test_task(&shared_state).await}});// endblock// Refactor these blocks into add functionlet shared_state = Arc::clone(&state);
scheduler.every(60.seconds()).run(move || {let shared_state = Arc::clone(&shared_state);asyncmove{test_task_two(&shared_state).await}});// endblock}asyncfntest_task_two(state:&Arc<State>){// do something}asyncfntest_task(state:&Arc<State>){// do something}
Thank you
The text was updated successfully, but these errors were encountered:
Hi, I am trying to use AsyncScheduler within my project and I was just wondering if there were any better or more ergonomic ways of doing this? I struggled a lot getting the state shared, but somehow got that working. Any tips or tricks greatly appreciated.
Thank you
The text was updated successfully, but these errors were encountered: