Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace the time.After with the timer for efficiency. #671

Merged
merged 2 commits into from
Mar 21, 2024

Conversation

DVasselli
Copy link

@DVasselli DVasselli commented Mar 21, 2024

The old time.After was not stopping the internal timer creating a huge resource overhead for frequently publishing clients. This way we stop the timer in the defer increasing efficiency.

Signed-off-by: Daniele Vasselli [email protected]

@MattBrittan
Copy link
Contributor

Thanks for the change; however this will deadlock if the timer does fire example. As the timer is not reused there is no real need to drain the channel.

@DVasselli
Copy link
Author

Ohhh I totally misunderstood the documentation of t.Stop(). I pushed it without the drain nd we'll let the GC take care of the channel after return

@MattBrittan
Copy link
Contributor

You are not the first person to do so. Thanks for the PR.

@MattBrittan MattBrittan merged commit 1a63b63 into eclipse-paho:master Mar 21, 2024
1 check passed
@DVasselli DVasselli deleted the clientTimer branch March 22, 2024 12:04
@DVasselli
Copy link
Author

Happy to have learned something new! Any chance you can make a new tag for this so I can import it?

@MattBrittan
Copy link
Contributor

Sorry - not going to do a new release for every small change. Just get the package with go get /github.com/eclipse/paho.mqtt.golang@master and you should get a version with the PR included.

algitbot pushed a commit to alpinelinux/build-server-status that referenced this pull request Sep 16, 2024
This MR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/eclipse/paho.mqtt.golang](https://github.com/eclipse/paho.mqtt.golang) | require | minor | `v1.4.3` -> `v1.5.0` |

---

### Release Notes

<details>
<summary>eclipse/paho.mqtt.golang (github.com/eclipse/paho.mqtt.golang)</summary>

### [`v1.5.0`](https://github.com/eclipse/paho.mqtt.golang/releases/tag/v1.5.0)

[Compare Source](eclipse-paho/paho.mqtt.golang@v1.4.3...v1.5.0)

In the year since the release of v1.4.3 the majority of changes have been small incremental improvements/fixes. One notable change is that Go v1.20+ is now required (due to MR [#&#8203;646](eclipse-paho/paho.mqtt.golang#646)).

#### What's Changed

-   Wrap connection network errors by [@&#8203;adriansmares](https://github.com/adriansmares) in eclipse-paho/paho.mqtt.golang#646
-   Clarify use of token.WaitTimeout by [@&#8203;MattBrittan](https://github.com/MattBrittan) in eclipse-paho/paho.mqtt.golang#659
-   fix ([#&#8203;661](eclipse-paho/paho.mqtt.golang#661)): Add NewClientOptionsReader for mocking purposes. by [@&#8203;avmunm](https://github.com/avmunm) in eclipse-paho/paho.mqtt.golang#662
-   fix: fix keep-alive timeouts on small intervals by [@&#8203;lefinal](https://github.com/lefinal) in eclipse-paho/paho.mqtt.golang#667
-   Replace the time.After with the timer for efficiency. by [@&#8203;DVasselli](https://github.com/DVasselli) in eclipse-paho/paho.mqtt.golang#671
-   fix: deprecation warnings for ioutil by [@&#8203;vruge](https://github.com/vruge) in eclipse-paho/paho.mqtt.golang#665
-   fix: issue 675:goroutine leak when connectionUp(true) return error by [@&#8203;kiqi007](https://github.com/kiqi007) in eclipse-paho/paho.mqtt.golang#678
-   Update dependencies by [@&#8203;MattBrittan](https://github.com/MattBrittan) in eclipse-paho/paho.mqtt.golang#683

#### New Contributors

-   [@&#8203;adriansmares](https://github.com/adriansmares) made their first contribution in eclipse-paho/paho.mqtt.golang#646
-   [@&#8203;avmunm](https://github.com/avmunm) made their first contribution in eclipse-paho/paho.mqtt.golang#662
-   [@&#8203;lefinal](https://github.com/lefinal) made their first contribution in eclipse-paho/paho.mqtt.golang#667
-   [@&#8203;DVasselli](https://github.com/DVasselli) made their first contribution in eclipse-paho/paho.mqtt.golang#671
-   [@&#8203;vruge](https://github.com/vruge) made their first contribution in eclipse-paho/paho.mqtt.golang#665
-   [@&#8203;kiqi007](https://github.com/kiqi007) made their first contribution in eclipse-paho/paho.mqtt.golang#678

**Full Changelog**: eclipse-paho/paho.mqtt.golang@v1.4.3...v1.5.0

</details>

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

&nbsp;
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC44MC4wIiwidXBkYXRlZEluVmVyIjoiMzguODAuMCIsInRhcmdldEJyYW5jaCI6Im1hc3RlciIsImxhYmVscyI6W119-->

See merge request alpine/infra/build-server-status!15
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