sleep 100ms to avoid DDOS

This commit is contained in:
chiahung 2023-10-17 13:51:51 +08:00
parent 5ff3828ec1
commit c257bc8ccf

View File

@ -110,6 +110,9 @@ func syncActiveOrders(ctx context.Context, opts SyncActiveOrdersOpts) error {
} else { } else {
opts.logger.Infof("found active order #%d is not in the open orders, updating...", activeOrder.OrderID) opts.logger.Infof("found active order #%d is not in the open orders, updating...", activeOrder.OrderID)
// sleep 100ms to avoid DDOS
time.Sleep(100 * time.Millisecond)
if err := syncActiveOrder(ctx, opts.activeOrderBook, opts.orderQueryService, activeOrder.OrderID); err != nil { if err := syncActiveOrder(ctx, opts.activeOrderBook, opts.orderQueryService, activeOrder.OrderID); err != nil {
opts.logger.WithError(err).Errorf("[ActiveOrderRecover] unable to query order #%d", activeOrder.OrderID) opts.logger.WithError(err).Errorf("[ActiveOrderRecover] unable to query order #%d", activeOrder.OrderID)
errs = multierr.Append(errs, err) errs = multierr.Append(errs, err)