2021-10-18 17:27:57 +03:00
|
|
|
const urlService = require('../../core/server/services/url');
|
2021-02-17 20:36:27 +03:00
|
|
|
|
|
|
|
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);
|
|
|
|
})();
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2021-02-22 17:09:39 +03:00
|
|
|
// @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();
|
|
|
|
};
|
|
|
|
|
2021-02-17 20:36:27 +03:00
|
|
|
module.exports.reset = () => {
|
|
|
|
urlService.softReset();
|
|
|
|
},
|
|
|
|
|
|
|
|
module.exports.resetGenerators = () => {
|
|
|
|
urlService.resetGenerators();
|
2021-02-22 17:09:39 +03:00
|
|
|
urlService.resources.reset();
|
2021-02-17 20:36:27 +03:00
|
|
|
};
|