Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
@@ -134,30 +134,31 @@ async fn main() -> anyhow::Result<()> {
|
||||
.add_fn(move |cancel| {
|
||||
let state = state.clone();
|
||||
async move {
|
||||
let nodrift_cancel = nodrift::schedule(std::time::Duration::from_millis(1), {
|
||||
let state = state.clone();
|
||||
move || {
|
||||
let nodrift_cancel =
|
||||
nodrift::schedule(std::time::Duration::from_millis(100), {
|
||||
let state = state.clone();
|
||||
let mut rng = rand::thread_rng();
|
||||
let category_index = rng.gen_range(0..CATEGORIES.len());
|
||||
move || {
|
||||
let state = state.clone();
|
||||
let mut rng = rand::thread_rng();
|
||||
let category_index = rng.gen_range(0..CATEGORIES.len());
|
||||
|
||||
async move {
|
||||
state
|
||||
.event_metrics
|
||||
.push_event(Event {
|
||||
event_name: CATEGORIES[category_index].to_string(),
|
||||
timestamp: std::time::SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.unwrap()
|
||||
.as_secs()
|
||||
as usize,
|
||||
})
|
||||
.await;
|
||||
async move {
|
||||
state
|
||||
.event_metrics
|
||||
.push_event(Event {
|
||||
event_name: CATEGORIES[category_index].to_string(),
|
||||
timestamp: std::time::SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.unwrap()
|
||||
.as_secs()
|
||||
as usize,
|
||||
})
|
||||
.await;
|
||||
|
||||
Ok(())
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
tokio::select! {
|
||||
_ = cancel.cancelled() => {
|
||||
|
Reference in New Issue
Block a user