orderStore: remove only filled orders and canceled orders

This commit is contained in:
c9s 2024-10-17 13:09:29 +08:00
parent 5fbb06639d
commit 7f0b8f38d5
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -147,9 +147,11 @@ func (s *OrderStore) Prune(expiryDuration time.Duration) {
defer s.mu.Unlock() defer s.mu.Unlock()
for idx, o := range s.orders { for idx, o := range s.orders {
if o.Status == types.OrderStatusCanceled || o.Status == types.OrderStatusFilled {
if o.UpdateTime.Time().Before(cutOffTime) { if o.UpdateTime.Time().Before(cutOffTime) {
continue continue
} }
}
orders[idx] = o orders[idx] = o
} }