Skip to content

Commit

Permalink
update poller chan
Browse files Browse the repository at this point in the history
  • Loading branch information
huangzhen1997 committed Sep 24, 2024
1 parent b4c9bf3 commit f83aad3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 0 additions & 4 deletions common/client/poller.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ func NewPoller[

var _ types.Subscription = &Poller[any]{}

func (p *Poller[T]) UpdateChannel(c chan<- T) {
p.channel = c
}

func (p *Poller[T]) Start() error {
return p.StartOnce("Poller", func() error {
p.wg.Add(1)
Expand Down
13 changes: 11 additions & 2 deletions core/chains/evm/client/rpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,12 +498,21 @@ func (r *rpcClient) SubscribeNewHead(ctx context.Context, channel chan<- *evmtyp
if r.newHeadsPollInterval > 0 {
interval := r.newHeadsPollInterval
timeout := interval
poller, _ := commonclient.NewPoller[*evmtypes.Head](interval, r.LatestBlock, timeout, r.rpcLog)
poller.UpdateChannel(channel)
poller, pollerCh := commonclient.NewPoller[*evmtypes.Head](interval, r.LatestBlock, timeout, r.rpcLog)
if err = poller.Start(); err != nil {
return nil, err
}

go func() {
for head := range pollerCh {
select {
case channel <- head:
case <-poller.Err():
return
}
}
}()

lggr.Infof("Polling new heads over http ")
return &poller, nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# If you want to use a specific commit or a branch you need to switch to the internal ECR in `~/.testsecrets`
# E2E_TEST_CHAINLINK_IMAGE="<aws account number>.dkr.ecr.<aws region>.amazonaws.com/chainlink-ccip"
[CCIP.Env.NewCLCluster.Common.ChainlinkImage]
version = "sha-6032cbb-root"
version = "sha-b4c9bf3-root"

[CCIP]
[CCIP.ContractVersions]
Expand Down

0 comments on commit f83aad3

Please sign in to comment.