fix: delete unpaid only if created and expires timestamp are the same
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-06-16 10:10:05 +01:00
parent ee01eae498
commit 51b8f42407

View File

@ -196,7 +196,8 @@ impl Worker {
self.check_vm(vm).await?; self.check_vm(vm).await?;
// delete vm if not paid (in new state) // delete vm if not paid (in new state)
if vm.expires < Utc::now().sub(Days::new(1)) { if vm.created == vm.expires && !vm.deleted && vm.expires < Utc::now().sub(Days::new(1))
{
info!("Deleting unpaid VM {}", vm.id); info!("Deleting unpaid VM {}", vm.id);
self.provisioner.delete_vm(vm.id).await?; self.provisioner.delete_vm(vm.id).await?;
} }