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
* does not give us that confidence since it returns immediately.
*/
const allTasks = (this.tasks || []).concat(newTasks);
const skipFirst = allTasks.slice(1);
const idxFirstNotConfig = skipFirst.findIndex((t) => t.name !== TaskName.Config);
const haveQueuedNonConfig = this.tasks.findIndex((t) => t.name !== TaskName.Config) !== -1;
let tasks = haveQueuedNonConfig ? newTasks : [];
if (!haveQueuedNonConfig) {
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 allTasksAfterFirstNotConfig) {
for (const task of tasks) {
if (task.name === TaskName.Config && task.hasSynthesizer) {
/* if they change synthesizer settings don't try to precache */
break;