feat: add common queue
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2024-11-24 21:08:37 +01:00
parent ee323e99e8
commit ea5adb2f93
15 changed files with 271 additions and 85 deletions

View File

@@ -1,11 +1,11 @@
use std::{net::SocketAddr, pin::Pin};
use std::{collections::BTreeMap, net::SocketAddr, pin::Pin};
use anyhow::Context;
use futures::Stream;
use notmad::{Component, MadError};
use tonic::transport::Server;
use crate::grpc::*;
use crate::{agent::models::Commands, grpc::*};
#[derive(Clone)]
pub struct GrpcServer {
@@ -70,9 +70,18 @@ impl crate::grpc::churn_server::Churn for GrpcServer {
loop {
interval.tick().await;
let Ok(schedule_task) = serde_json::to_string(&Commands::ScheduleTask {
task: "refresh".into(),
properties: BTreeMap::default(),
}) else {
tracing::warn!("failed to serialize event");
continue;
};
if let Err(e) = tx
.send(Ok(ListenEventsResponse {
value: uuid::Uuid::new_v4().to_string(),
id: uuid::Uuid::new_v4().to_string(),
value: schedule_task,
}))
.await
{