in operationsbus/hooks.go [71:102]
func (h *HookedApiOperation) GuardConcurrency(ctx context.Context, entity Entity) *CategorizedError {
logger := ctxlogger.GetLogger(ctx)
var herr error
logger.Info("Running BeforeGuardConcurrency hooks.")
for _, hook := range h.OperationHooks {
herr = hook.BeforeGuardConcurrency(ctx, h.Operation, entity)
if herr != nil {
logger.Error("Something went wrong running a BeforeGuardConcurrency hook: " + herr.Error())
return &CategorizedError{
Message: herr.Error(),
Err: herr,
}
}
}
logger.Info("Running operation guard concurrency.")
ce := h.Operation.GuardConcurrency(ctx, entity)
logger.Info("Running AfterGuardConcurrency hooks.")
for _, hook := range h.OperationHooks {
herr = hook.AfterGuardConcurrency(ctx, h.Operation, ce)
if herr != nil {
logger.Error("Something went wrong running a AfterGuardConcurrency hook: " + herr.Error())
return &CategorizedError{
Message: herr.Error(),
Err: herr,
}
}
}
return ce
}