Fix run all missplacement (#31)
This commit is contained in:
parent
ac28d01158
commit
2f708060f7
|
@ -127,19 +127,13 @@ where
|
||||||
let (commands_sender, commands_receiver) = tokio::sync::mpsc::channel(16);
|
let (commands_sender, commands_receiver) = tokio::sync::mpsc::channel(16);
|
||||||
let handle = OverwatchHandle::new(runtime.handle().clone(), commands_sender);
|
let handle = OverwatchHandle::new(runtime.handle().clone(), commands_sender);
|
||||||
let services = S::new(settings, handle.clone())?;
|
let services = S::new(settings, handle.clone())?;
|
||||||
let mut runner = OverwatchRunner {
|
let runner = OverwatchRunner {
|
||||||
services,
|
services,
|
||||||
handle: handle.clone(),
|
handle: handle.clone(),
|
||||||
finish_signal_sender,
|
finish_signal_sender,
|
||||||
};
|
};
|
||||||
|
|
||||||
let lifecycle_handlers = runner.services.start_all()?;
|
runtime.spawn(async move { runner.run_(commands_receiver).await });
|
||||||
|
|
||||||
runtime.spawn(async move {
|
|
||||||
runner
|
|
||||||
.run_(commands_receiver, lifecycle_handlers.clone())
|
|
||||||
.await
|
|
||||||
});
|
|
||||||
|
|
||||||
Ok(Overwatch {
|
Ok(Overwatch {
|
||||||
runtime,
|
runtime,
|
||||||
|
@ -149,16 +143,13 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(name = "overwatch-run", skip_all)]
|
#[instrument(name = "overwatch-run", skip_all)]
|
||||||
async fn run_(
|
async fn run_(self, mut receiver: Receiver<OverwatchCommand>) {
|
||||||
self,
|
|
||||||
mut receiver: Receiver<OverwatchCommand>,
|
|
||||||
lifecycle_handlers: ServicesLifeCycleHandle,
|
|
||||||
) {
|
|
||||||
let Self {
|
let Self {
|
||||||
mut services,
|
mut services,
|
||||||
handle: _,
|
handle: _,
|
||||||
finish_signal_sender,
|
finish_signal_sender,
|
||||||
} = self;
|
} = self;
|
||||||
|
let lifecycle_handlers = services.start_all().expect("Services to start running");
|
||||||
while let Some(command) = receiver.recv().await {
|
while let Some(command) = receiver.recv().await {
|
||||||
info!(command = ?command, "Overwatch command received");
|
info!(command = ?command, "Overwatch command received");
|
||||||
match command {
|
match command {
|
||||||
|
|
Loading…
Reference in New Issue