Correct zero rate to 1 too
This commit is contained in:
		
							parent
							
								
									0f4bed32c8
								
							
						
					
					
						commit
						ec98145508
					
				@ -122,10 +122,10 @@ func (d *BaseDaemon) Publish(msg []byte) {
 | 
				
			|||||||
	d.publisher.Publish(msg)
 | 
						d.publisher.Publish(msg)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// LimitRate limits the daemons processing rate.
 | 
					// LimitRate limits the daemons' processing rate.
 | 
				
			||||||
func (d *BaseDaemon) LimitRate(times int, per time.Duration) {
 | 
					func (d *BaseDaemon) LimitRate(times int, per time.Duration) {
 | 
				
			||||||
	rate := float64(time.Second) / float64(per) * float64(times)
 | 
						rate := float64(time.Second) / float64(per) * float64(times)
 | 
				
			||||||
	if rate < 0 {
 | 
						if rate <= 0 {
 | 
				
			||||||
		log.Println("Daemon %s processing rate was limited to %d. Using 1 instead", d.base(), rate)
 | 
							log.Println("Daemon %s processing rate was limited to %d. Using 1 instead", d.base(), rate)
 | 
				
			||||||
		rate = 1.0
 | 
							rate = 1.0
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user