mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 01:02:25 -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
				
			
		
							
								
								
									
										35
									
								
								vendor/github.com/cenkalti/backoff/v4/timer.go
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								vendor/github.com/cenkalti/backoff/v4/timer.go
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,35 @@ | |||
| package backoff | ||||
| 
 | ||||
| import "time" | ||||
| 
 | ||||
| type Timer interface { | ||||
| 	Start(duration time.Duration) | ||||
| 	Stop() | ||||
| 	C() <-chan time.Time | ||||
| } | ||||
| 
 | ||||
| // defaultTimer implements Timer interface using time.Timer | ||||
| type defaultTimer struct { | ||||
| 	timer *time.Timer | ||||
| } | ||||
| 
 | ||||
| // C returns the timers channel which receives the current time when the timer fires. | ||||
| func (t *defaultTimer) C() <-chan time.Time { | ||||
| 	return t.timer.C | ||||
| } | ||||
| 
 | ||||
| // Start starts the timer to fire after the given duration | ||||
| func (t *defaultTimer) Start(duration time.Duration) { | ||||
| 	if t.timer == nil { | ||||
| 		t.timer = time.NewTimer(duration) | ||||
| 	} else { | ||||
| 		t.timer.Reset(duration) | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| // Stop is called when the timer is not used anymore and resources may be freed. | ||||
| func (t *defaultTimer) Stop() { | ||||
| 	if t.timer != nil { | ||||
| 		t.timer.Stop() | ||||
| 	} | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue