1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-12-22 17:06:17 +00:00

Ensure transcoding failures are never cached

By re-raising any exceptions that `transcode` encounters while running
the transcode, it ensures that `set_generated` will also see the
exception, preventing it from caching an incomplete transcode.
This commit is contained in:
Carey Metcalfe 2019-02-03 23:12:11 -05:00
parent 0ac2376e07
commit 07342529e0

View File

@ -123,10 +123,11 @@ def stream_media():
if dec_proc != None: if dec_proc != None:
dec_proc.kill() dec_proc.kill()
proc.kill() proc.kill()
raise
if dec_proc != None: finally:
dec_proc.wait() if dec_proc != None:
proc.wait() dec_proc.wait()
proc.wait()
resp_content = cache.set_generated(cache_key, transcode) resp_content = cache.set_generated(cache_key, transcode)
logger.info('Transcoding track {0.id} for user {1.id}. Source: {2} at {0.bitrate}kbps. Dest: {3} at {4}kbps'.format(res, request.user, src_suffix, dst_suffix, dst_bitrate)) logger.info('Transcoding track {0.id} for user {1.id}. Source: {2} at {0.bitrate}kbps. Dest: {3} at {4}kbps'.format(res, request.user, src_suffix, dst_suffix, dst_bitrate))