From 3cf329cb091a50bef79f5557a6b926a269d60d11 Mon Sep 17 00:00:00 2001 From: harsh-98 Date: Fri, 29 Nov 2024 22:50:49 +0700 Subject: [PATCH] if single asset error more than 10 times per day --- go.mod | 2 +- go.sum | 4 ++-- models/aggregated_block_feed/single_asset_feed/main.go | 8 ++++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 6b1ccfff..bc537ccc 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/Gearbox-protocol/third-eye go 1.20 require ( - github.com/Gearbox-protocol/sdk-go v0.0.0-20241128021016-b2b80f42b5c8 + github.com/Gearbox-protocol/sdk-go v0.0.0-20241129154424-efc7511894e0 github.com/ethereum/go-ethereum v1.13.14 github.com/go-playground/validator/v10 v10.4.1 github.com/google/go-cmp v0.5.9 diff --git a/go.sum b/go.sum index 46bd9803..b6a6276e 100644 --- a/go.sum +++ b/go.sum @@ -5,8 +5,8 @@ contrib.go.opencensus.io/exporter/ocagent v0.6.0/go.mod h1:zmKjrJcdo0aYcVS7bmEeS github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= -github.com/Gearbox-protocol/sdk-go v0.0.0-20241128021016-b2b80f42b5c8 h1:5qA7lq25Ua/cUOh99rMOsisriR0d9jxZziSYDf/tbz0= -github.com/Gearbox-protocol/sdk-go v0.0.0-20241128021016-b2b80f42b5c8/go.mod h1:jRBSOG94bpGc5ci8EWIPUVXZdaGEaekMNmhajbmWFVU= +github.com/Gearbox-protocol/sdk-go v0.0.0-20241129154424-efc7511894e0 h1:zJ5cviNSuRnPLYRghQ3R4O/4XoCE2BW1crQIEGc4SHM= +github.com/Gearbox-protocol/sdk-go v0.0.0-20241129154424-efc7511894e0/go.mod h1:jRBSOG94bpGc5ci8EWIPUVXZdaGEaekMNmhajbmWFVU= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OffchainLabs/go-ethereum v1.13.4-0.20240313010929-e5d8587e7227 h1:+/3TrD+q+BP36jGj2Bycdmrc/joKLNbc5ImePQzKRLM= diff --git a/models/aggregated_block_feed/single_asset_feed/main.go b/models/aggregated_block_feed/single_asset_feed/main.go index f1d904ad..3066b64f 100644 --- a/models/aggregated_block_feed/single_asset_feed/main.go +++ b/models/aggregated_block_feed/single_asset_feed/main.go @@ -2,6 +2,8 @@ package single_asset_feed import ( "encoding/hex" + "fmt" + "time" "github.com/Gearbox-protocol/sdk-go/artifacts/multicall" "github.com/Gearbox-protocol/sdk-go/artifacts/redstone" @@ -75,14 +77,16 @@ func (mdl *SingleAssetFeed) GetCalls(blockNum int64) (calls []multicall.Multical return calls, true } +var counter = log.SendMsgIfCountMoreThan(24*time.Hour, 10) + // same as query price feed // func (*YearnPriceFeed) GetCalls(blockNum int64) (calls []multicall.Multicall2Call, isQueryable bool) { func (mdl *SingleAssetFeed) ProcessResult(blockNum int64, results []multicall.Multicall2Result, force ...bool) *schemas.PriceFeed { result := results[len(results)-1] if !result.Success { - log.Warnf("Can't get latestRounData for YearnModule in AQFWrapper for %s(%s) at %d", - mdl.GetDetailsByKey("pfType"), mdl.GetAddress(), blockNum) + counter(mdl.GetAddress(), fmt.Sprintf("Can't get latestRounData for YearnModule in AQFWrapper for %s(%s) at %d", + mdl.GetDetailsByKey("pfType"), mdl.GetAddress(), blockNum)) return nil // }