launch streaming to update booking

This commit is contained in:
mr
2025-06-18 09:14:30 +02:00
parent f61c9f5df9
commit c0b8ac1eee
2 changed files with 44 additions and 34 deletions

View File

@@ -281,6 +281,12 @@ func (o *BookingController) Post() {
o.ServeJSON()
return
}
if b.Data.(*booking.Booking).ResourceType == tools.COMPUTE_RESOURCE {
go func() {
time.Sleep(time.Until(b.Data.(*booking.Booking).ExpectedStartDate))
infrastructure.NewPrometheusService().Stream(b.Data.GetID(), b.Data.(*booking.Booking).ExpectedEndDate, 1*time.Second, nil, nil)
}()
}
if err := o.createNamespace(resp.ExecutionsID); err != nil {
fmt.Println(err.Error())