mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 22:43:30 +03:00
70ed998838
refs dd715b33dc
- this is the last event that is used to trigger part of the standard boot process
- events make the code harder to read/reason about
- the urlservice is one of the most core and critical components in Ghost, possibly the biggest consumer of time and memory
- we want to have the work it is doing front and center so that we can improve it
32 lines
807 B
JavaScript
32 lines
807 B
JavaScript
const urlService = require('../../core/frontend/services/url');
|
|
|
|
module.exports.isFinished = async (options = {disableDbReadyEvent: false}) => {
|
|
let timeout;
|
|
|
|
return new Promise(function (resolve) {
|
|
(function retry() {
|
|
clearTimeout(timeout);
|
|
|
|
if (urlService.hasFinished()) {
|
|
return resolve();
|
|
}
|
|
|
|
timeout = setTimeout(retry, 50);
|
|
})();
|
|
});
|
|
};
|
|
|
|
// @TODO: unify all the reset/softTeset helpers so they either work how the main code works or the reasons why they are different are clear
|
|
module.exports.init = () => {
|
|
urlService.init();
|
|
};
|
|
|
|
module.exports.reset = () => {
|
|
urlService.softReset();
|
|
},
|
|
|
|
module.exports.resetGenerators = () => {
|
|
urlService.resetGenerators();
|
|
urlService.resources.reset();
|
|
};
|