mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 14:42:26 -05:00 
			
		
		
		
	feat: initial tracing support (#1623)
This commit is contained in:
		
					parent
					
						
							
								878ed48de3
							
						
					
				
			
			
				commit
				
					
						6392e00653
					
				
			
		
					 472 changed files with 102600 additions and 12 deletions
				
			
		
							
								
								
									
										38
									
								
								vendor/github.com/cenkalti/backoff/v4/tries.go
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								vendor/github.com/cenkalti/backoff/v4/tries.go
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,38 @@ | |||
| package backoff | ||||
| 
 | ||||
| import "time" | ||||
| 
 | ||||
| /* | ||||
| WithMaxRetries creates a wrapper around another BackOff, which will | ||||
| return Stop if NextBackOff() has been called too many times since | ||||
| the last time Reset() was called | ||||
| 
 | ||||
| Note: Implementation is not thread-safe. | ||||
| */ | ||||
| func WithMaxRetries(b BackOff, max uint64) BackOff { | ||||
| 	return &backOffTries{delegate: b, maxTries: max} | ||||
| } | ||||
| 
 | ||||
| type backOffTries struct { | ||||
| 	delegate BackOff | ||||
| 	maxTries uint64 | ||||
| 	numTries uint64 | ||||
| } | ||||
| 
 | ||||
| func (b *backOffTries) NextBackOff() time.Duration { | ||||
| 	if b.maxTries == 0 { | ||||
| 		return Stop | ||||
| 	} | ||||
| 	if b.maxTries > 0 { | ||||
| 		if b.maxTries <= b.numTries { | ||||
| 			return Stop | ||||
| 		} | ||||
| 		b.numTries++ | ||||
| 	} | ||||
| 	return b.delegate.NextBackOff() | ||||
| } | ||||
| 
 | ||||
| func (b *backOffTries) Reset() { | ||||
| 	b.numTries = 0 | ||||
| 	b.delegate.Reset() | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue