gausby / tortoise

A MQTT Client written in Elixir
Apache License 2.0
314 stars 54 forks source link

Allow setting publish connection timeouts #123

Closed jfcloutier closed 4 years ago

jfcloutier commented 4 years ago

When publishing, one should be able to set a timeout on establishing the connection so that the timeout does not default to :infinity

I've been experiencing intermittent "lock ups" of a genserver client of Tortoise. I could not identify the precise cause but this PR would remove a potential cause.

coveralls commented 4 years ago

Pull Request Test Coverage Report for Build 5


Files with Coverage Reduction New Missed Lines %
lib/tortoise/connection/receiver.ex 2 84.38%
<!-- Total: 2 -->
Totals Coverage Status
Change from base Build 43: -0.3%
Covered Lines: 562
Relevant Lines: 642

đź’› - Coveralls
gausby commented 4 years ago

One thing though; this timeout will in the sync version of the call be used for the entire life-cycle of the publish, not just getting the connection—for the async version the timeout will only count for the time it takes to obtain the connection, not the time it takes before the messages has been delivered and acknowledged—this might cause some confusion, but let's get it in; Note to self: the MQTT 5 version of Tortoise should not have any :infinity defaults, and instead default to 5_000