From 960d44defc77a065ce81f47b5bcdcd9406565039 Mon Sep 17 00:00:00 2001 From: Karel Moravec Date: Mon, 16 Oct 2023 17:07:27 +0200 Subject: [PATCH] fix: do not spam the DB --- core/execution/common/liquidity_provision.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/execution/common/liquidity_provision.go b/core/execution/common/liquidity_provision.go index 9378f6aa20d..3fb00284f81 100644 --- a/core/execution/common/liquidity_provision.go +++ b/core/execution/common/liquidity_provision.go @@ -308,7 +308,10 @@ func (m *MarketLiquidity) OnEpochEnd(ctx context.Context, t time.Time) { m.calculateAndDistribute(ctx, t) // report liquidity fees allocation stats - m.broker.Send(events.NewPaidLiquidityFeesStatsEvent(ctx, m.liquidityEngine.PaidLiquidityFeesStats().ToProto(m.marketID, m.asset))) + feeStats := m.liquidityEngine.PaidLiquidityFeesStats() + if !feeStats.TotalFeesPaid.IsZero() { + m.broker.Send(events.NewPaidLiquidityFeesStatsEvent(ctx, feeStats.ToProto(m.marketID, m.asset))) + } } func (m *MarketLiquidity) OnMarketClosed(ctx context.Context, t time.Time) {