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 var m sync.Mutex
for _, b := range bookings { 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++ { 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 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() m.Lock()
// deep copy du caller // deep copy du caller
@ -112,6 +112,7 @@ func getBooking(l zerolog.Logger, b *booking.Booking, request *tools.APIRequest,
errCh <- err errCh <- err
return return
} }
m.Unlock()
// Delock // Delock
bl := l.With().Str("booking", b.UUID).Logger() bl := l.With().Str("booking", b.UUID).Logger()
meth := request.Caller.URLS[tools.BOOKING][tools.GET] meth := request.Caller.URLS[tools.BOOKING][tools.GET]