MCPcopy Index your code
hub / github.com/loopbackio/loopback-next / stop

Method stop

packages/core/src/application.ts:398–412  ·  view source on GitHub ↗

* Stop the application instance and all of its registered observers. The * application state is checked to ensure the integrity of `stop`. * * If the application is already stopped or not started, no operation is * performed.

()

Source from the content-addressed store, hash-verified

396 * performed.
397 */
398 public async stop(): Promise<void> {
399 if (this._state === 'stopping') return this.awaitState('stopped');
400 this.assertNotInProcess('stop');
401 // No-op if it's created or stopped
402 if (this._state !== 'started' && this._state !== 'initialized') return;
403 this.setState('stopping');
404 if (!this._isShuttingDown) {
405 // Explicit stop is called, let's remove signal listeners to avoid
406 // memory leak and max listener warning
407 this.removeSignalListener();
408 }
409 const registry = await this.getLifeCycleObserverRegistry();
410 await registry.stop();
411 this.setState('stopped');
412 }
413
414 /**
415 * Register a function to be called when the application starts.

Callers 1

setupShutdownMethod · 0.95

Calls 6

awaitStateMethod · 0.95
assertNotInProcessMethod · 0.95
setStateMethod · 0.95
removeSignalListenerMethod · 0.95
stopMethod · 0.65

Tested by

no test coverage detected