backend-plus 2.5.2-betha.15 → 2.5.2-betha.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/backend-plus.d.ts +1 -1
- package/lib/backend-plus.js +36 -33
- package/package.json +1 -1
package/lib/backend-plus.d.ts
CHANGED
|
@@ -587,7 +587,7 @@ export class AppBackend{
|
|
|
587
587
|
messages:Record<LangId,Record<string, string>>
|
|
588
588
|
}
|
|
589
589
|
shutdownCallbackListAdd(param:{message:string, fun:()=>Promise<void>}):void
|
|
590
|
-
shutdownBackend():Promise<void>
|
|
590
|
+
shutdownBackend(opts?:{skipTurnOff?:boolean, onlyTurnOff?:boolean}):Promise<void>
|
|
591
591
|
setLog(opts:{until:string, results?:boolean}):void
|
|
592
592
|
getDataDumpTransformations(rawData:string):Promise<{rawData:string, prepareTransformationSql:string[], endTransformationSql:string[]}>
|
|
593
593
|
}
|
package/lib/backend-plus.js
CHANGED
|
@@ -643,33 +643,42 @@ AppBackend.prototype.start = function start(opts){
|
|
|
643
643
|
// @ts-ignore : only for testing */
|
|
644
644
|
this.getMainApp = function getMainApp(){ return mainApp; };
|
|
645
645
|
}
|
|
646
|
-
this.shutdownBackend = async function shutdownBackend(){
|
|
647
|
-
|
|
648
|
-
var
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
646
|
+
this.shutdownBackend = async function shutdownBackend(opts){
|
|
647
|
+
var shootingDown = opts == null || !opts.onlyTurnOff;
|
|
648
|
+
var turningOff = opts == null || !opts.skipTurnOff;
|
|
649
|
+
if(!shootingDown){
|
|
650
|
+
console.log('shooting down:');
|
|
651
|
+
var waitFor = [
|
|
652
|
+
new Promise(function(resolve,reject){
|
|
653
|
+
console.log('*','express server');
|
|
654
|
+
be.server.close(/** @param {Error} err */function(err){
|
|
655
|
+
if(err){
|
|
656
|
+
console.log('*', err)
|
|
657
|
+
reject(err);
|
|
658
|
+
}else{
|
|
659
|
+
console.log('*','express server done!')
|
|
660
|
+
resolve();
|
|
661
|
+
}
|
|
662
|
+
});
|
|
663
|
+
}),
|
|
664
|
+
...(be.shutdownCallbackList.map(x => (async function(){
|
|
665
|
+
console.log('shut:', x.message)
|
|
666
|
+
await x.fun()
|
|
667
|
+
console.log('done:', x.message)
|
|
668
|
+
})())),
|
|
669
|
+
];
|
|
670
|
+
console.log('*', 'waiting for all')
|
|
671
|
+
await Promise.all(waitFor);
|
|
672
|
+
console.log('*', 'all done')
|
|
673
|
+
mainApp = null;
|
|
674
|
+
}
|
|
675
|
+
if(turningOff){
|
|
676
|
+
console.log('turning off:');
|
|
677
|
+
await pg.shutdown();
|
|
678
|
+
console.log('pg shutdown done!');
|
|
679
|
+
console.log('* logWhy',logWhy)
|
|
680
|
+
logWhy && logWhy();
|
|
681
|
+
}
|
|
673
682
|
};
|
|
674
683
|
return Promise.resolve().then(function(){
|
|
675
684
|
var configList=be.configList();
|
|
@@ -1008,12 +1017,6 @@ AppBackend.prototype.start = function start(opts){
|
|
|
1008
1017
|
mainApp.loginPlusManager.closeManager();
|
|
1009
1018
|
}
|
|
1010
1019
|
});
|
|
1011
|
-
be.shutdownCallbackListAdd({
|
|
1012
|
-
message:'pg',
|
|
1013
|
-
fun:function(){
|
|
1014
|
-
pg.shutdown();
|
|
1015
|
-
}
|
|
1016
|
-
});
|
|
1017
1020
|
mainApp.loginPlusManager.setValidatorStrategy(
|
|
1018
1021
|
function(req, username, password, done) {
|
|
1019
1022
|
var client;
|
package/package.json
CHANGED