mirror of
				https://github.com/coredns/coredns.git
				synced 2025-11-02 10:13:14 -05:00 
			
		
		
		
	
		
			
	
	
		
			14 lines
		
	
	
		
			339 B
		
	
	
	
		
			Go
		
	
	
	
	
	
		
		
			
		
	
	
			14 lines
		
	
	
		
			339 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| 
								 | 
							
								package erratic
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import "sync/atomic"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// Ready returns true if the number of received queries is in the range [3, 5). All other values return false.
							 | 
						||
| 
								 | 
							
								// To aid in testing we want to this flip between ready and not ready.
							 | 
						||
| 
								 | 
							
								func (e *Erratic) Ready() bool {
							 | 
						||
| 
								 | 
							
									q := atomic.LoadUint64(&e.q)
							 | 
						||
| 
								 | 
							
									if q >= 3 && q < 5 {
							 | 
						||
| 
								 | 
							
										return true
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
									return false
							 | 
						||
| 
								 | 
							
								}
							 |