grid2: call TryLock in updateGridNumOfOrdersMetricsWithLock

This commit is contained in:
c9s 2023-06-30 01:05:18 +08:00
parent 5c5543d78a
commit fc7edc5c80
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -1179,7 +1179,11 @@ func (s *Strategy) updateFilledOrderMetrics(order types.Order) {
} }
func (s *Strategy) updateGridNumOfOrdersMetricsWithLock() { func (s *Strategy) updateGridNumOfOrdersMetricsWithLock() {
s.updateGridNumOfOrdersMetrics(s.getGrid()) if s.mu.TryLock() {
grid := s.grid
s.mu.Unlock()
s.updateGridNumOfOrdersMetrics(grid)
}
} }
func (s *Strategy) updateGridNumOfOrdersMetrics(grid *Grid) { func (s *Strategy) updateGridNumOfOrdersMetrics(grid *Grid) {