mirror of
				https://gitea.invidious.io/iv-org/shard-kemal.git
				synced 2024-08-15 00:53:36 +00:00 
			
		
		
		
	Move signal trapping to Kemal::Application
This commit is contained in:
		
							parent
							
								
									e6dc494f7e
								
							
						
					
					
						commit
						5f1ce1e0fc
					
				
					 2 changed files with 7 additions and 8 deletions
				
			
		|  | @ -19,8 +19,14 @@ class Kemal::Application < Kemal::Base | ||||||
|       end |       end | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     # Test environment doesn't need to have signal trap, built-in images, and logging. |     # Test environment doesn't need to have signal trap and built-in images. | ||||||
|     unless @config.env == "test" |     unless @config.env == "test" | ||||||
|  |       Signal::INT.trap do | ||||||
|  |         log "Kemal is going to take a rest!" if @config.shutdown_message? | ||||||
|  |         stop if running? | ||||||
|  |         exit | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|       # This route serves the built-in images for not_found and exceptions. |       # This route serves the built-in images for not_found and exceptions. | ||||||
|       self.get "/__kemal__/:image" do |env| |       self.get "/__kemal__/:image" do |env| | ||||||
|         image = env.params.url["image"] |         image = env.params.url["image"] | ||||||
|  |  | ||||||
|  | @ -77,13 +77,6 @@ class Kemal::Base | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   private def prepare_for_server_start |   private def prepare_for_server_start | ||||||
|     unless @config.env == "test" |  | ||||||
|       Signal::INT.trap do |  | ||||||
|         log "Kemal is going to take a rest!" if @config.shutdown_message? |  | ||||||
|         stop if running? |  | ||||||
|         exit |  | ||||||
|       end |  | ||||||
|     end |  | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   private def start_server(port) |   private def start_server(port) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue