celsworth / lxp-bridge

A bridge to MQTT/InfluxDB/Postgres for communications with LuxPower inverters
MIT License
14 stars 16 forks source link

Revert "Set up channel receivers early" #146

Closed lupine closed 1 year ago

lupine commented 1 year ago

Reverts celsworth/lxp-bridge#145

Sorry @celsworth, I've just noticed a regression caused by this PR.

In src/lxp/inverter.rs, the flow is start { while connect() { sender() } }

Since we call sender in a loop, and since that's where the take is, any time the inverter reconnects, lxp-bridge dies with the error "should only be called once" :grimacing:

Best to revert the whole thing and maybe revisit once your integration test suite is in place :sweat_smile:

As it happens, I think I've got an approach to broadcasting the holding registers that doesn't need this PR anyway. I was working on that when I triggered this bug! Hopefully I'll have something to show tonight.

celsworth commented 1 year ago

Oops :)

Yeah the integration suite is a bit dodgy at the moment, its a good start but its quite easy to make it hang through race conditions. Could do with setting it up to run in CI first off then I might take a look at improving it and adding more tests.