mirror of
				https://github.com/django/daphne.git
				synced 2025-11-04 01:27:33 +03:00 
			
		
		
		
	Tweak idle delays for better performance
This commit is contained in:
		
							parent
							
								
									fff69f64a7
								
							
						
					
					
						commit
						eaa762c9e3
					
				| 
						 | 
					@ -27,14 +27,14 @@ class Server(object):
 | 
				
			||||||
        Run in a separate thread; reads messages from the backend.
 | 
					        Run in a separate thread; reads messages from the backend.
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        channels = self.factory.reply_channels()
 | 
					        channels = self.factory.reply_channels()
 | 
				
			||||||
        delay = 0.3
 | 
					        delay = 0.05
 | 
				
			||||||
        # Quit if reactor is stopping
 | 
					        # Quit if reactor is stopping
 | 
				
			||||||
        if not reactor.running:
 | 
					        if not reactor.running:
 | 
				
			||||||
            logging.debug("Backend reader quitting due to reactor stop")
 | 
					            logging.debug("Backend reader quitting due to reactor stop")
 | 
				
			||||||
            return
 | 
					            return
 | 
				
			||||||
        # Don't do anything if there's no channels to listen on
 | 
					        # Don't do anything if there's no channels to listen on
 | 
				
			||||||
        if channels:
 | 
					        if channels:
 | 
				
			||||||
            delay = 0.05
 | 
					            delay = 0.01
 | 
				
			||||||
            channel, message = self.channel_layer.receive_many(channels, block=False)
 | 
					            channel, message = self.channel_layer.receive_many(channels, block=False)
 | 
				
			||||||
            if channel:
 | 
					            if channel:
 | 
				
			||||||
                delay = 0
 | 
					                delay = 0
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user