From 5ea3ce39b1f3692cbb11505507836c21a3da3bd5 Mon Sep 17 00:00:00 2001 From: billettc Date: Wed, 31 Jan 2024 08:44:01 -0500 Subject: [PATCH] bump firecore --- Dockerfile | 2 +- block/fetcher/rpc.go | 19 +++++++++++-------- go.mod | 2 +- go.sum | 1 + 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2b6329dc..d62f7cb0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1.2 -FROM ghcr.io/streamingfast/firehose-core:c2781fa as core +FROM ghcr.io/streamingfast/firehose-core:a4ba225 as core FROM ubuntu:20.04 diff --git a/block/fetcher/rpc.go b/block/fetcher/rpc.go index 237abe8d..10753e5a 100644 --- a/block/fetcher/rpc.go +++ b/block/fetcher/rpc.go @@ -61,7 +61,9 @@ func (f *RPCFetcher) IsBlockAvailable(requestedSlot uint64) bool { func (f *RPCFetcher) Fetch(ctx context.Context, requestedSlot uint64) (out *pbbstream.Block, skip bool, err error) { f.logger.Info("fetching block", zap.Uint64("block_num", requestedSlot)) + sleepDuration := time.Duration(0) for f.latestConfirmedSlot < requestedSlot { + time.Sleep(sleepDuration) f.latestConfirmedSlot, err = f.rpcClient.GetSlot(ctx, rpc.CommitmentConfirmed) if err != nil { return nil, false, fmt.Errorf("fetching latestConfirmedSlot block num: %w", err) @@ -69,13 +71,15 @@ func (f *RPCFetcher) Fetch(ctx context.Context, requestedSlot uint64) (out *pbbs f.logger.Info("got latest confirmed slot block", zap.Uint64("latest_confirmed_slot", f.latestConfirmedSlot), zap.Uint64("requested_block_num", requestedSlot)) // - if f.latestConfirmedSlot < requestedSlot { - time.Sleep(f.latestBlockRetryInterval) - continue + if f.latestConfirmedSlot >= requestedSlot { + break } - break + sleepDuration = f.latestBlockRetryInterval } + + sleepDuration = time.Duration(0) for f.latestFinalizedSlot < requestedSlot { + time.Sleep(sleepDuration) f.latestFinalizedSlot, err = f.rpcClient.GetSlot(ctx, rpc.CommitmentFinalized) if err != nil { return nil, false, fmt.Errorf("fetching latest finalized Slot block num: %w", err) @@ -83,11 +87,10 @@ func (f *RPCFetcher) Fetch(ctx context.Context, requestedSlot uint64) (out *pbbs f.logger.Info("got latest finalized slot block", zap.Uint64("latest_finalized_slot", f.latestFinalizedSlot), zap.Uint64("request_block_num", requestedSlot)) // - if f.latestFinalizedSlot < requestedSlot { - time.Sleep(f.latestBlockRetryInterval) - continue + if f.latestFinalizedSlot >= requestedSlot { + break } - break + sleepDuration = f.latestBlockRetryInterval } blockResult, skip, err := f.fetch(ctx, requestedSlot) diff --git a/go.mod b/go.mod index 788eb6a4..a85dcd2b 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,7 @@ require ( github.com/streamingfast/bstream v0.0.2-0.20240118123300-2bc69dde3598 github.com/streamingfast/cli v0.0.4-0.20230825151644-8cc84512cd80 github.com/streamingfast/dstore v0.1.1-0.20230620124109-3924b3b36c77 - github.com/streamingfast/firehose-core v1.0.1-0.20240129204613-f839e5d69f02 + github.com/streamingfast/firehose-core v1.0.1-0.20240131133941-a4ba225c6f6b github.com/streamingfast/logging v0.0.0-20230608130331-f22c91403091 github.com/streamingfast/solana-go v0.5.1-0.20230622180848-8faf68a7cb1d github.com/test-go/testify v1.1.4 diff --git a/go.sum b/go.sum index 962dc1c4..baebaf32 100644 --- a/go.sum +++ b/go.sum @@ -708,6 +708,7 @@ github.com/streamingfast/dtracing v0.0.0-20220305214756-b5c0e8699839 h1:K6mJPvh1 github.com/streamingfast/dtracing v0.0.0-20220305214756-b5c0e8699839/go.mod h1:huOJyjMYS6K8upTuxDxaNd+emD65RrXoVBvh8f1/7Ns= github.com/streamingfast/firehose-core v1.0.1-0.20240129204613-f839e5d69f02 h1:drsRlqWE3vKaCsM/tdsaonlBITcL7lvBeHNL82VNEjw= github.com/streamingfast/firehose-core v1.0.1-0.20240129204613-f839e5d69f02/go.mod h1:mwzlzxtjSqJy81zFv1X77+YoKhe59rBZopisrQTmaqo= +github.com/streamingfast/firehose-core v1.0.1-0.20240131133941-a4ba225c6f6b/go.mod h1:mwzlzxtjSqJy81zFv1X77+YoKhe59rBZopisrQTmaqo= github.com/streamingfast/gagliardetto-solana-go v0.0.0-20240115191424-05c37cd0760d h1:Db3yKJeN5DWPz8pesR9tuFXdbs0MnpRLmov+ttsHoTU= github.com/streamingfast/gagliardetto-solana-go v0.0.0-20240115191424-05c37cd0760d/go.mod h1:i+7aAyNDTHG0jK8GZIBSI4OVvDqkt2Qx+LklYclRNG8= github.com/streamingfast/jsonpb v0.0.0-20210811021341-3670f0aa02d0 h1:g8eEYbFSykyzIyuxNMmHEUGGUvJE0ivmqZagLDK42gw=