writable: false
});
-function isStandalone() {
- return global['serviceType'] === 'STANDALONE';
-}
-
function createWorker(id: string, startService: string, filename: string) {
if (workers[id])
return;
export function startService(id: string, filename: string) {
console.log(`startService - ${id}`);
- if (isStandalone()) {
- runner = require('../common/service_runner');
- runner.start(id, filename);
- } else {
- let startService = `${__dirname}/service_runner.js`;
- createWorker(id, startService, filename);
- }
+ let startService = `${__dirname}/service_runner.js`;
+ createWorker(id, startService, filename);
}
export function stopService(id: string) {
console.log(`stopService - ${id}`);
- if (isStandalone()) {
- if (!runner) {
- console.log('runner instance is null in standalone mode');
- return;
- }
- runner.stop(id);
- } else {
- terminateWorker(id, 500);
- }
+ terminateWorker(id, 500);
}
export function handleBuiltinService(serviceId: string, serviceName: string) {