mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
grid2: call TryLock in updateGridNumOfOrdersMetricsWithLock
This commit is contained in:
parent
5c5543d78a
commit
fc7edc5c80
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user