fix empty server detection and add option to manage existing instances

This commit is contained in:
Robin Appelman 2021-08-09 16:35:59 +02:00
commit 86adb69a95
4 changed files with 13 additions and 1 deletions

View file

@ -130,7 +130,15 @@ async fn run_loop(
start_schedule: Schedule,
stop_schedule: Schedule,
) {
let mut active_server: Option<Server> = None;
let mut active_server = if config.server.manage_existing {
cloud
.list()
.await
.map(|servers| servers.into_iter().next())
.unwrap_or_default()
} else {
None
};
loop {
let next_start = start_schedule.upcoming(Utc).next().unwrap();