-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
87 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ let running_task_menu, | |
* | ||
* @author Jelle De Loecker <[email protected]> | ||
* @since 1.3.17 | ||
* @version 1.3.17 | ||
* @version 1.4.0 | ||
*/ | ||
const Service = Function.inherits('Alchemy.Base', 'Alchemy.Task', function TaskService() { | ||
|
||
|
@@ -33,10 +33,6 @@ const Service = Function.inherits('Alchemy.Base', 'Alchemy.Task', function TaskS | |
this.initSchedules(); | ||
|
||
singleton = this; | ||
|
||
if (alchemy.settings.task.janeway_menu) { | ||
this.createJanewayTaskMenu(); | ||
} | ||
}); | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -412,30 +412,10 @@ Alchemy.setMethod(function setMaxEventLoopLag(max_lag) { | |
* | ||
* @author Jelle De Loecker <[email protected]> | ||
* @since 1.3.17 | ||
* @version 1.3.17 | ||
* @version 1.4.0 | ||
*/ | ||
Alchemy.setMethod(function afterStart() { | ||
this.startTaskService(); | ||
}); | ||
|
||
let task_service_has_started = false; | ||
|
||
/** | ||
* Start the task service | ||
* | ||
* @author Jelle De Loecker <[email protected]> | ||
* @since 1.3.17 | ||
* @version 1.3.17 | ||
*/ | ||
Alchemy.setMethod(function startTaskService() { | ||
|
||
if (task_service_has_started) { | ||
return; | ||
} | ||
|
||
task_service_has_started = true; | ||
|
||
this.task_service = new Classes.Alchemy.Task.TaskService(); | ||
|
||
}); | ||
|
||
/** | ||
|
@@ -2366,6 +2346,8 @@ Alchemy.setMethod(function start(options, callback) { | |
STAGES.launch([ | ||
'load_app', | ||
'datasource', | ||
'tasks', | ||
'settings', | ||
'routes', | ||
'server', | ||
]); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,18 +58,4 @@ const connect = datasource.createStage('connect', () => { | |
}); | ||
|
||
return Function.parallel(tasks); | ||
}); | ||
|
||
/** | ||
* "datasource.connect.load_settings" | ||
* Load any possible settings in the database | ||
* | ||
* @author Jelle De Loecker <[email protected]> | ||
* @since 1.4.0 | ||
* @version 1.4.0 | ||
* | ||
* @type {Alchemy.Stages.Stage} | ||
*/ | ||
const load_settings = connect.createStage('load_settings', () => { | ||
console.log('Should load settings..') | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* The "tasks" stage | ||
* | ||
* @author Jelle De Loecker <[email protected]> | ||
* @since 1.4.0 | ||
* @version 1.4.0 | ||
* | ||
* @type {Alchemy.Stages.Stage} | ||
*/ | ||
const tasks = STAGES.createStage('tasks'); | ||
|
||
// Do not start any task stage before the datasources are connected | ||
tasks.dependsOn('datasource.connect'); | ||
|
||
/** | ||
* "tasks.start_service" | ||
* Start the task service | ||
* | ||
* @author Jelle De Loecker <[email protected]> | ||
* @since 1.4.0 | ||
* @version 1.4.0 | ||
* | ||
* @type {Alchemy.Stages.Stage} | ||
*/ | ||
const start_service = tasks.createStage('start_service', () => { | ||
alchemy.task_service = new Classes.Alchemy.Task.TaskService(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/** | ||
* The "settings" stage. | ||
* The settings definitions should already be loaded. | ||
* The hard-coded settings too. | ||
* In this stage, we load the settings from the database. | ||
* | ||
* @author Jelle De Loecker <[email protected]> | ||
* @since 1.4.0 | ||
* @version 1.4.0 | ||
* | ||
* @type {Alchemy.Stages.Stage} | ||
*/ | ||
const settings = STAGES.createStage('settings'); | ||
|
||
// Do not start this stage before the datasources are connected | ||
settings.dependsOn('datasource.connect'); | ||
|
||
/** | ||
* "settings.load" | ||
* Load the settings from the database | ||
* | ||
* @author Jelle De Loecker <[email protected]> | ||
* @since 1.4.0 | ||
* @version 1.4.0 | ||
* | ||
* @type {Alchemy.Stages.Stage} | ||
*/ | ||
const load = settings.createStage('load', async () => { | ||
|
||
let records = await Model.get('AlchemySetting').find('all'); | ||
|
||
if (!records.length) { | ||
return; | ||
} | ||
|
||
for (let record of records) { | ||
await record.applySetting(false); | ||
} | ||
}); | ||
|
||
|
||
/** | ||
* "datasource.connect.load_settings" | ||
* Load any possible settings in the database | ||
* | ||
* @author Jelle De Loecker <[email protected]> | ||
* @since 1.4.0 | ||
* @version 1.4.0 | ||
* | ||
* @type {Alchemy.Stages.Stage} | ||
*/ | ||
const perform_actions = settings.createStage('perform_actions', async () => { | ||
await alchemy.system_settings.performAllActions(); | ||
}); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters