Skip to content

refactor(rpc): allocate PingPongLatencyTimer on start (backport #2804)#2812

Merged
melekes merged 3 commits intov1.xfrom
mergify/bp/v1.x/pr-2804
Apr 15, 2024
Merged

refactor(rpc): allocate PingPongLatencyTimer on start (backport #2804)#2812
melekes merged 3 commits intov1.xfrom
mergify/bp/v1.x/pr-2804

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Apr 15, 2024

Followup to #2792 which closed #2771.

#2792 does not handle the case where Start is never called. If Start is not called, Stop returns an error, thus with #2792's implementation the only way to ensure that PingPongLatencyTimer is cleaned up is to call Start and Stop, even when not using any of the features provided by Start (i.e. events).

This PR moves initialization of PingPongLatencyTimer into OnStart so that it is only initialized if it is going to be used. This PR also moves cleanup of PingPongLatencyTimer into readRoutine's defer statement to align it with other cleanup (i.e. closing the connection).

PR checklist

  • Tests written/updated
  • Changelog entry added in .changelog (we use unclog to manage our changelog)
  • Updated relevant documentation (docs/ or spec/) and code comments
  • Title follows the Conventional Commits spec

This is an automatic backport of pull request #2804 done by [Mergify](https://mergify.com).

Followup to #2792 which closed #2771.

#2792 does not handle the case where Start is never called. If Start is
not called, Stop returns an error, thus with #2792's implementation the
only way to ensure that PingPongLatencyTimer is cleaned up is to call
Start and Stop, even when not using any of the features provided by
Start (i.e. events).

This PR moves initialization of PingPongLatencyTimer into OnStart so
that it is only initialized if it is going to be used. This PR also
moves cleanup of PingPongLatencyTimer into readRoutine's defer statement
to align it with other cleanup (i.e. closing the connection).

#### PR checklist

- [ ] Tests written/updated
- [ ] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [ ] Updated relevant documentation (`docs/` or `spec/`) and code
comments
- [ ] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec

(cherry picked from commit 312d1d4)
@mergify mergify bot requested a review from a team as a code owner April 15, 2024 09:26
@mergify mergify bot requested a review from a team April 15, 2024 09:26
@melekes melekes merged commit 9875622 into v1.x Apr 15, 2024
@melekes melekes deleted the mergify/bp/v1.x/pr-2804 branch April 15, 2024 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants