Piston not completing & not producing logs


I’m having problems with this piston, its worked fine in the past.

The piston announces what is played on plex, and is called by plex as a webhook. The first call (line 55) sets up a message to play on the sonos, and then pauses the plex playback. This causes plex to call the piston again, with a pause request. This is handled from line 67, and sends the message to the sonos. It then waits a calculated time for the message to be spoken, before sending a play command back to plex to resume playback.
It all works up to the wait, but the command to resume playback on plex isn’t sent. Also there are no log entries for the play & pause calls.

I suspect the problem is with the wait, or a second instance being called possibly before the first has finished. Single events from the plex hook work fine, and produce log entries.