fix: spawn only if vms are not expired
This commit is contained in:
parent
464b823944
commit
7d8956e7c7
@ -80,7 +80,7 @@ impl ProxmoxClient {
|
||||
.await?;
|
||||
let status = rsp.status();
|
||||
let text = rsp.text().await?;
|
||||
info!("<< {}", text);
|
||||
//info!("<< {}", text);
|
||||
if status.is_success() {
|
||||
Ok(serde_json::from_str(&text)?)
|
||||
} else {
|
||||
@ -100,7 +100,7 @@ impl ProxmoxClient {
|
||||
.await?;
|
||||
let status = rsp.status();
|
||||
let text = rsp.text().await?;
|
||||
info!("<< {}", text);
|
||||
//info!("<< {}", text);
|
||||
if status.is_success() {
|
||||
Ok(serde_json::from_str(&text)?)
|
||||
} else {
|
||||
|
@ -3,6 +3,7 @@ use crate::provisioner::lnvps::LNVpsProvisioner;
|
||||
use crate::provisioner::Provisioner;
|
||||
use crate::status::{VmRunningState, VmState, VmStateCache};
|
||||
use anyhow::{bail, Result};
|
||||
use chrono::Utc;
|
||||
use fedimint_tonic_lnd::Client;
|
||||
use ipnetwork::IpNetwork;
|
||||
use lnvps_db::{LNVpsDb, Vm, VmHost};
|
||||
@ -137,9 +138,11 @@ impl Worker {
|
||||
}
|
||||
Err(e) => {
|
||||
warn!("Failed to get VM status: {}", e);
|
||||
if vm.expires > Utc::now() {
|
||||
self.spawn_vm(&vm, &host, &client).await?;
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user