Disable pre-fetching of sentences with variables

This commit is contained in:
Ruben van de Ven 2019-11-14 20:23:59 +01:00
parent de82f73363
commit bf3c9cc962
1 changed files with 6 additions and 5 deletions

View File

@ -143,11 +143,12 @@ class Message(object):
self.variableValues[name] = value
self.logger.warn(f"Set variable, fetch {name}")
if not None in self.variableValues.values():
self.logger.warn(f"now fetch {name} for {self.id}")
asyncio.get_event_loop().create_task(self.getAudioFilePath())
# asyncio.get_event_loop().call_soon_threadsafe(self.getAudioFilePath)
# self.logger.warn(f"started {name}")
# disable prefetching of audio files, to avoid a bunch of calls at once to the voice api's
# Other possiblity would be to wrap getAudioFilePath() into a method that delays execution incrementally
# with an asyncio.sleep(i)
# if not None in self.variableValues.values():
# self.logger.warn(f"now fetch {name} for {self.id}")
# asyncio.get_event_loop().create_task(self.getAudioFilePath())
def getVariableValue(self, var):
return self.variableValues[var] if (self.variableValues[var] is not None) else self.story.configuration.nothing_text #TODO: translate nothing to each language