minor improvements from static code analysis
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is failing
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	continuous-integration/drone/push Build is failing
				
			This commit is contained in:
		
							parent
							
								
									714462c36f
								
							
						
					
					
						commit
						5d5af6e926
					
				
					 5 changed files with 5 additions and 13 deletions
				
			
		
							
								
								
									
										1
									
								
								go.sum
									
										
									
									
									
								
							
							
						
						
									
										1
									
								
								go.sum
									
										
									
									
									
								
							|  | @ -1,3 +1,4 @@ | |||
| gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= | ||||
| gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||||
| gopkg.in/eapache/queue.v1 v1.1.0 h1:EldqoJEGtXYiVCMRo2C9mePO2UUGnYn2+qLmlQSqPdc= | ||||
| gopkg.in/eapache/queue.v1 v1.1.0/go.mod h1:wNtmx1/O7kZSR9zNT1TTOJ7GLpm3Vn7srzlfylFbQwU= | ||||
|  |  | |||
|  | @ -4,16 +4,13 @@ import ( | |||
| 	"runtime" | ||||
| 	"sync" | ||||
| 	"testing" | ||||
| 	"time" | ||||
| ) | ||||
| 
 | ||||
| var testQ = NewQueue() | ||||
| 
 | ||||
| func testAdd(n int) { | ||||
| 	for i := 0; i < n; i++ { | ||||
| 		testQ.Add(func() { | ||||
| 			time.Sleep(1) | ||||
| 		}) | ||||
| 		testQ.Add(func() {}) | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -33,10 +33,7 @@ func SimpleScheduler(tq *TaskQueue) bool { | |||
| 			queued++ | ||||
| 		} | ||||
| 	} | ||||
| 	if queued > 0 { | ||||
| 		return true | ||||
| 	} | ||||
| 	return false | ||||
| 	return (queued > 0) | ||||
| } | ||||
| 
 | ||||
| // TimeSliceScheduler attempts to give tasks a fair share of the Stats() | ||||
|  |  | |||
							
								
								
									
										2
									
								
								stats.go
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								stats.go
									
										
									
									
									
								
							|  | @ -74,7 +74,7 @@ func (s *Stat) Start() (start time.Time) { | |||
| // This will fluctuate between 90-100% of the window size set when the state | ||||
| // was created, as internal buckets roll over. | ||||
| func (s *Stat) Duration() time.Duration { | ||||
| 	return time.Now().Sub(s.Start()) | ||||
| 	return time.Since(s.Start()) | ||||
| } | ||||
| 
 | ||||
| // Rate returns the flow rate of this counter, which is the current rolling | ||||
|  |  | |||
|  | @ -11,10 +11,7 @@ func (list UIntSlice) Len() int { | |||
| 
 | ||||
| // Less helps fulfill sort.Interface. | ||||
| func (list UIntSlice) Less(i, j int) bool { | ||||
| 	if list[i] <= list[j] { | ||||
| 		return true | ||||
| 	} | ||||
| 	return false | ||||
| 	return list[i] <= list[j] | ||||
| } | ||||
| 
 | ||||
| // Swap helps fulfill sort.Interface | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue