In CheckBooking mooved the loop on bookings outside of the loop of execs, which seems to repeat the Peer execution on booking an exponential number of time

This commit is contained in:
pb 2025-05-26 17:55:45 +02:00
parent 2a763006db
commit 370dac201b

View File

@ -82,18 +82,18 @@ func (ws *WorkflowSchedule) CheckBooking(wfID string, request *tools.APIRequest)
for i, exec := range execs { for i, exec := range execs {
l.Debug().Msg("looping throughs execs : " + string(i)) l.Debug().Msg("looping throughs execs : " + string(i))
bookings = append(bookings, exec.Book(ws.UUID, wfID, priceds)...) bookings = append(bookings, exec.Book(ws.UUID, wfID, priceds)...)
for _, b := range bookings { }
meth := request.Caller.URLS[tools.BOOKING][tools.GET] for _, b := range bookings {
meth = strings.ReplaceAll(meth, ":id", b.ResourceID) meth := request.Caller.URLS[tools.BOOKING][tools.GET]
meth = strings.ReplaceAll(meth, ":start_date", b.ExpectedStartDate.Format("2006-01-02T15:04:05")) meth = strings.ReplaceAll(meth, ":id", b.ResourceID)
meth = strings.ReplaceAll(meth, ":end_date", b.ExpectedEndDate.Format("2006-01-02T15:04:05")) meth = strings.ReplaceAll(meth, ":start_date", b.ExpectedStartDate.Format("2006-01-02T15:04:05"))
request.Caller.URLS[tools.BOOKING][tools.GET] = meth meth = strings.ReplaceAll(meth, ":end_date", b.ExpectedEndDate.Format("2006-01-02T15:04:05"))
l.Debug().Msg("Get booking on" + b.DestPeerID) request.Caller.URLS[tools.BOOKING][tools.GET] = meth
_, err := (&peer.Peer{}).LaunchPeerExecution(b.DestPeerID, b.ResourceID, tools.BOOKING, tools.GET, nil, request.Caller) l.Debug().Msg("Get booking on" + b.DestPeerID)
l.Debug().Msg("Received response from Get booking on " + b.DestPeerID) _, err := (&peer.Peer{}).LaunchPeerExecution(b.DestPeerID, b.ResourceID, tools.BOOKING, tools.GET, nil, request.Caller)
if err != nil { l.Debug().Msg("Received response from Get booking on " + b.DestPeerID)
return false, wf, execs, bookings, err if err != nil {
} return false, wf, execs, bookings, err
} }
} }