Check for pending events before updating the config

Small optimisation that significantly reduces number of config updates.
This commit is contained in:
Ingvar Stepanyan
2021-07-23 20:04:32 +00:00
parent 86f9be758f
commit ca75f61289
2 changed files with 18 additions and 2 deletions

View File

@@ -79,7 +79,12 @@ class App extends Component {
type: 'Config',
config
});
await new Promise(resolve => setTimeout(resolve, 100));
do {
await new Promise(resolve => setTimeout(resolve, 100));
} while (
!(await this.connection.schedule(context => context.hasPendingEvent()))
);
console.log('Event!');
}
}