bushvin / hass-integrations

My custom Home Assistant integrations
Apache License 2.0
62 stars 11 forks source link

service calls are skipped when called in quick succession #60

Open Switch123456789 opened 10 months ago

Switch123456789 commented 10 months ago

Hey hey, I noticed an issue whenever services are called in quick succession, sometimes (not always) only the first command gets executed. For example, I have a ha-script that sets consume_mode shuffle & repeat in this order but the only thing that gets applied is the consume-mode.

Switch123456789 commented 10 months ago

I did A LOT of testing and found out that calls in succession work fine but calls in parallel occasionally cause one or more calls to get skipped.

The reason why only consume mode is set in my first example is that another script is running in parallel that adds a song to the playlist and it is pretty random which call gets skipped if one or more calls are executed in parallel. I am 90% sure about that assessment. I will keep on testing :)

bushvin commented 10 months ago

The actions which did not result in the expected state, did they return an error? The only thing I can think of which might be happening, is that the Mopidy client api wrapper is busy and drops requests while it is busy. Time to introduce a task queue, maybe...

Switch123456789 commented 9 months ago

The actions which did not result in the expected state, did they return an error?

I have to reproduce that to check for errors. I already adjusted my scripts to work around that. In hindsight, doing it in parallel wasn't a good idea for me anyway :smile: Next year I will get back at it, test and report, as I do :smile_cat: