- use cached audio before backend's one

This commit is contained in:
Dmytro Bogovych 2023-08-22 18:15:51 +03:00
parent 26098649f2
commit 6afb7f9f12
1 changed files with 7 additions and 7 deletions

View File

@ -312,14 +312,14 @@ def run_caller_task(t):
os.remove(LOADED_AUDIO)
audio_id = t["audio_id"]
if CACHE.get_reference_audio(audio_id, LOADED_AUDIO):
utils.log(f'Reference audio {audio_id} found in cache.')
else:
utils.log(f'Reference audio {audio_id} not found in cache.')
if not BackendServer.load_audio(audio_id, LOADED_AUDIO):
utils.log_error(f'Failed to load reference audio with ID {audio_id}.')
if CACHE.get_reference_audio(audio_id, LOADED_AUDIO):
utils.log(f' Found in cache.')
else:
utils.log(f' Failed to find the audio in cache.')
raise RuntimeError(f'Reference audio (ID: {audio_id}) is not available.')
else:
# Cache loaded audio
CACHE.add_reference_audio(audio_id, LOADED_AUDIO)