mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-27 11:18:14 +01:00 
			
		
		
		
	Add JS docs for server stop
This commit is contained in:
		
							parent
							
								
									21d0d43edc
								
							
						
					
					
						commit
						9a634e0de5
					
				| @ -284,7 +284,7 @@ class Server { | ||||
|         await this.stop() | ||||
|         Logger.info('Server stopped. Exiting.') | ||||
|       } else { | ||||
|         Logger.info('SIGINT (Ctrl+C) received again. Exiting immediately.')         | ||||
|         Logger.info('SIGINT (Ctrl+C) received again. Exiting immediately.') | ||||
|       } | ||||
|       process.exit(0) | ||||
|     }) | ||||
| @ -395,6 +395,10 @@ class Server { | ||||
|     res.sendStatus(200) | ||||
|   } | ||||
| 
 | ||||
|   /** | ||||
|    * Gracefully stop server | ||||
|    * Stops watcher and socket server | ||||
|    */ | ||||
|   async stop() { | ||||
|     Logger.info('=== Stopping Server ===') | ||||
|     await this.watcher.close() | ||||
|  | ||||
| @ -73,10 +73,15 @@ class SocketAuthority { | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   /** | ||||
|    * Closes the Socket.IO server and disconnect all clients | ||||
|    *  | ||||
|    * @param {Function} callback  | ||||
|    */ | ||||
|   close(callback) { | ||||
|     Logger.info('[SocketAuthority] Shutting down') | ||||
|     // This will close all open socket connections, and also close the underlying http server
 | ||||
|     if (this.io)  | ||||
|     if (this.io) | ||||
|       this.io.close(callback) | ||||
|     else | ||||
|       callback() | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user