hass-integrations icon indicating copy to clipboard operation
hass-integrations copied to clipboard

service calls are skipped when called in quick succession

Open Switch123456789 opened this issue 1 year ago • 3 comments

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 avatar Dec 12 '23 16:12 Switch123456789

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 :)

Switch123456789 avatar Dec 12 '23 20:12 Switch123456789

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...

bushvin avatar Dec 13 '23 09:12 bushvin

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:

Switch123456789 avatar Dec 30 '23 22:12 Switch123456789