mirror of
				https://github.com/oarkflow/mq.git
				synced 2025-10-31 23:42:33 +08:00 
			
		
		
		
	init: publisher
This commit is contained in:
		
							
								
								
									
										11
									
								
								utils/retry.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								utils/retry.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| package utils | ||||
|  | ||||
| import ( | ||||
| 	"math/rand" | ||||
| 	"time" | ||||
| ) | ||||
|  | ||||
| func CalculateJitter(baseDelay time.Duration, percent float64) time.Duration { | ||||
| 	jitter := time.Duration(rand.Float64()*percent*float64(baseDelay)) - time.Duration(percent*float64(baseDelay)/2) | ||||
| 	return baseDelay + jitter | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 sujit
					sujit