Avoid process pyth message in analytic (#235)
This commit is contained in:
parent
abf4a690da
commit
2028277b30
|
@ -63,7 +63,7 @@ func main() {
|
|||
|
||||
// create and start a consumer.
|
||||
vaaConsumeFunc := newVAAConsume(rootCtx, config, logger)
|
||||
consumer := consumer.New(vaaConsumeFunc, metric.Push, logger)
|
||||
consumer := consumer.New(vaaConsumeFunc, metric.Push, logger, config.P2pNetwork)
|
||||
consumer.Start(rootCtx)
|
||||
|
||||
// create and start server.
|
||||
|
|
|
@ -5,7 +5,9 @@ import (
|
|||
|
||||
"github.com/wormhole-foundation/wormhole-explorer/analytic/metric"
|
||||
"github.com/wormhole-foundation/wormhole-explorer/analytic/queue"
|
||||
"github.com/wormhole-foundation/wormhole-explorer/common/domain"
|
||||
"github.com/wormhole-foundation/wormhole/sdk/vaa"
|
||||
vaa_sdk "github.com/wormhole-foundation/wormhole/sdk/vaa"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
@ -14,11 +16,12 @@ type Consumer struct {
|
|||
consume queue.VAAConsumeFunc
|
||||
pushMetric metric.MetricPushFunc
|
||||
logger *zap.Logger
|
||||
p2pNetwork string
|
||||
}
|
||||
|
||||
// New creates a new vaa consumer.
|
||||
func New(consume queue.VAAConsumeFunc, pushMetric metric.MetricPushFunc, logger *zap.Logger) *Consumer {
|
||||
return &Consumer{consume: consume, pushMetric: pushMetric, logger: logger}
|
||||
func New(consume queue.VAAConsumeFunc, pushMetric metric.MetricPushFunc, logger *zap.Logger, p2pNetwork string) *Consumer {
|
||||
return &Consumer{consume: consume, pushMetric: pushMetric, logger: logger, p2pNetwork: p2pNetwork}
|
||||
}
|
||||
|
||||
// Start consumes messages from VAA queue, parse and store those messages in a repository.
|
||||
|
@ -42,6 +45,13 @@ func (c *Consumer) Start(ctx context.Context) {
|
|||
continue
|
||||
}
|
||||
|
||||
// filter vaa from pythnet.
|
||||
if c.p2pNetwork == domain.P2pMainNet && vaa_sdk.ChainIDPythNet == vaa.EmitterChain {
|
||||
c.logger.Debug("Skip vaa from pythnet", zap.String("id", event.ID))
|
||||
msg.Done()
|
||||
continue
|
||||
}
|
||||
|
||||
// push vaa metrics.
|
||||
err = c.pushMetric(ctx, vaa)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue