fix(core): Refactored configuration management classes and improved service update handling

This commit is contained in:
2024-12-20 01:29:21 +01:00
parent a72227ce0d
commit 5badfc72f4
8 changed files with 137 additions and 128 deletions

View File

@@ -10,7 +10,7 @@ export class SparkTaskManager {
// tasks
public updateSpark: plugins.taskbuffer.Task;
public updateHost: plugins.taskbuffer.Task;
public updateCloudly: plugins.taskbuffer.Task;
public updateServices: plugins.taskbuffer.Task;
constructor(sparkRefArg: Spark) {
this.sparkRef = sparkRefArg;
@@ -56,7 +56,10 @@ export class SparkTaskManager {
},
});
this.updateCloudly = new plugins.taskbuffer.Task({
/**
* only being run when mode is cloudly
*/
this.updateServices = new plugins.taskbuffer.Task({
name: 'updateCloudly',
taskFunction: async () => {
logger.log('info', 'now running updateCloudly task');
@@ -69,9 +72,9 @@ export class SparkTaskManager {
* start the taskmanager
*/
public async start() {
this.taskmanager.addAndScheduleTask(this.updateServices, '30 */2 * * * *');
this.taskmanager.addAndScheduleTask(this.updateSpark, '0 * * * * *');
this.taskmanager.addAndScheduleTask(this.updateHost, '0 0 0 * * *');
this.taskmanager.addAndScheduleTask(this.updateCloudly, '30 */2 * * * *');
this.taskmanager.start();
}
@@ -81,7 +84,7 @@ export class SparkTaskManager {
public async stop() {
this.taskmanager.descheduleTask(this.updateSpark);
this.taskmanager.descheduleTask(this.updateHost);
this.taskmanager.descheduleTask(this.updateCloudly);
this.taskmanager.descheduleTask(this.updateServices);
this.taskmanager.stop();
}
}