proper fix for precache (#721)

* proper fix for precache

* wip
This commit is contained in:
Dave Horton
2024-04-15 16:25:12 -04:00
committed by GitHub
parent e322b7d8d3
commit 1a2aa91973

View File

@@ -1606,15 +1606,15 @@ Duration=${duration} `
* to be confident we have some time before the say verb is executed, and the Config * to be confident we have some time before the say verb is executed, and the Config
* does not give us that confidence since it returns immediately. * does not give us that confidence since it returns immediately.
*/ */
const allTasks = (this.tasks || []).concat(newTasks); const haveQueuedNonConfig = this.tasks.findIndex((t) => t.name !== TaskName.Config) !== -1;
const skipFirst = allTasks.slice(1); let tasks = haveQueuedNonConfig ? newTasks : [];
const idxFirstNotConfig = skipFirst.findIndex((t) => t.name !== TaskName.Config); if (!haveQueuedNonConfig) {
if (-1 === idxFirstNotConfig) return; const idxFirstNotConfig = newTasks.findIndex((t) => t.name !== TaskName.Config);
if (-1 === idxFirstNotConfig) return;
tasks = newTasks.slice(idxFirstNotConfig + 1);
}
const allTasksAfterFirstNotConfig = skipFirst.slice(idxFirstNotConfig); for (const task of tasks) {
for (const task of allTasksAfterFirstNotConfig) {
if (task.name === TaskName.Config && task.hasSynthesizer) { if (task.name === TaskName.Config && task.hasSynthesizer) {
/* if they change synthesizer settings don't try to precache */ /* if they change synthesizer settings don't try to precache */
break; break;