Repository navigation
Fix current picture retry logic - #3253
Conversation
f97894b to
db76c7b
Compare
|
This looks like an elegant solution, many thanks. Do you have a set of settings or timing to replicate the issue with an empty response? Keeping the request open seems benefitial in any case, but replicating the exact issue with some added debug output might be a good learning, and probably the same affects other part of the code. |
Yes, of course, this can be replicated by:
As far as I can see, this only affects Maybe we could add an HTTP error when no picture is available? For example: |
Replace IOLoop.add_timeout() with an awaited retry so the HTTP request remains open until a frame is available or the retry limit is reached.
db76c7b to
5898c19
Compare
Fixes an issue where /picture/<id>/current did not return JPEG images when no frame was available yet.
The retry logic previously used
IOLoop.add_timeout(), which scheduled a retry but immediately closed the HTTP request.As a result, the client could receive a response with Content-Type: image/jpeg but an empty body.
The retry now runs within the same request using an awaited sleep, keeping the request open while waiting for the first JPEG frame from the internal MJPEG client, up to the intended retry limit.
This behavior matches the existing comment in the code, and I think it reflects the intended behavior?:
motioneye/motioneye/handlers/picture.py
Lines 114 to 116 in 4f1b7b5
#2978