grid2: prevent infinite loop

This commit is contained in:
c9s 2022-12-23 23:50:30 +08:00
parent ae20cef8f4
commit 8715d0aca9
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -1036,7 +1036,8 @@ func (s *Strategy) recoverGrid(ctx context.Context, historyService types.Exchang
return err
}
if len(closedOrders) == 0 {
// need to prevent infinite loop for: len(closedOrders) == 1 and it's creationTime = startTime
if len(closedOrders) == 0 || len(closedOrders) == 1 && closedOrders[0].CreationTime.Time().Equal(startTime) {
break
}