twelve version
Deploy / Test, build and deploy (push) Successful in 50s

This commit is contained in:
2026-06-08 20:11:10 +00:00
parent 82cd1936ea
commit f877907b20
9 changed files with 284 additions and 18 deletions
+8 -1
View File
@@ -192,7 +192,14 @@ func (e *Engine) placeLimit(ctx context.Context, order domain.Order, freeOrderLi
if err != nil {
draft.Status = domain.OrderStatusFailed
if e.store != nil {
_ = e.store.UpsertOrder(ctx, draft)
if persistErr := e.store.RunInTx(ctx, func(ctx context.Context, repo repository.Repository) error {
if err := repo.UpsertOrder(ctx, draft); err != nil {
return fmt.Errorf("persist failed order: %w", err)
}
return repo.IncrementFreeOrders(ctx, order.TradeDate, order.InstrumentUID, -1)
}); persistErr != nil {
return domain.Order{}, errors.Join(err, fmt.Errorf("rollback failed order reservation: %w", persistErr))
}
}
return domain.Order{}, err
}