From 400768006fb5082a8c7e44c3b8b4da0ee89ae482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Men=C3=A9ndez?= Date: Wed, 17 Apr 2024 11:43:46 +0200 Subject: [PATCH] fixing farcaster bug with error --- cmd/census3/main.go | 2 +- scanner/providers/farcaster/provider.go | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cmd/census3/main.go b/cmd/census3/main.go index 5c21fddf..999d553c 100644 --- a/cmd/census3/main.go +++ b/cmd/census3/main.go @@ -147,7 +147,7 @@ func main() { } for _, uri := range config.listOfWeb3Providers { if err := w3p.AddEndpoint(uri); err != nil { - log.Warnw("error adding web3 provider (%s): %w", uri, err) + log.Warnf("error adding web3 provider (%s): %w", uri, err) } } // init the database diff --git a/scanner/providers/farcaster/provider.go b/scanner/providers/farcaster/provider.go index cc7fb60f..11d21023 100644 --- a/scanner/providers/farcaster/provider.go +++ b/scanner/providers/farcaster/provider.go @@ -354,6 +354,11 @@ func (p *FarcasterProvider) keyRegistryCreationBlock() uint64 { // before the next iteration. It also updates the last block scanned and the // sync vars of the provider. func (p *FarcasterProvider) initInternalScanner() { + defer func() { + if err := p.Close(); err != nil { + log.Warnf("error closing provider: %s", err.Error()) + } + }() for { select { case <-p.scannerCtx.Done(): @@ -363,8 +368,8 @@ func (p *FarcasterProvider) initInternalScanner() { defer downloading.Store(false) lastBlock, idrSynced, krSynced, err := p.scanIteration(p.scannerCtx) if err != nil { - log.Errorf("error scanning iteration: %s", err.Error()) - continue + log.Warnf("error scanning iteration: %s", err.Error()) + return } p.contracts.lastBlock.Store(lastBlock) log.Debugw("scanning iteration finished, sleeping...",