forgot to pass the mutex as pointer and unlock it

This commit is contained in:
pb 2025-05-27 11:17:10 +02:00
parent fec23b4acd
commit 5ab3eb8a38

View File

@ -90,7 +90,7 @@ func (ws *WorkflowSchedule) CheckBooking(wfID string, request *tools.APIRequest)
var m sync.Mutex
for _, b := range bookings {
go getBooking(l, b, request, wf, execs, bookings, errCh, m)
go getBooking(l, b, request, wf, execs, bookings, errCh, &m)
}
for i := 0; i < len(bookings); i++ {
@ -102,7 +102,7 @@ func (ws *WorkflowSchedule) CheckBooking(wfID string, request *tools.APIRequest)
return true, wf, execs, bookings, nil
}
func getBooking(l zerolog.Logger, b *booking.Booking, request *tools.APIRequest, wf *workflow.Workflow, execs []*WorkflowExecution, bookings []*booking.Booking, errCh chan error, m sync.Mutex) {
func getBooking(l zerolog.Logger, b *booking.Booking, request *tools.APIRequest, wf *workflow.Workflow, execs []*WorkflowExecution, bookings []*booking.Booking, errCh chan error, m *sync.Mutex) {
m.Lock()
// deep copy du caller
@ -112,6 +112,7 @@ func getBooking(l zerolog.Logger, b *booking.Booking, request *tools.APIRequest,
errCh <- err
return
}
m.Unlock()
// Delock
bl := l.With().Str("booking", b.UUID).Logger()
meth := request.Caller.URLS[tools.BOOKING][tools.GET]