mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-31 02:03:20 -04:00 
			
		
		
		
	* plugin/cancel: add context cancelation plugin Per review comments on #2704, move this into a plugin that gets called. Add the most minimal plugin, tests and documenation. Signed-off-by: Miek Gieben <miek@miek.nl> * plugin/cache: add timeout option review feedback: add option to set custom timeout. Signed-off-by: Miek Gieben <miek@miek.nl> * spelling Signed-off-by: Miek Gieben <miek@miek.nl>
		
			
				
	
	
		
			15 lines
		
	
	
		
			247 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
		
			247 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package plugin
 | |
| 
 | |
| import "context"
 | |
| 
 | |
| // Done is a non-blocking function that returns true if the context has been canceled.
 | |
| func Done(ctx context.Context) bool {
 | |
| 	select {
 | |
| 	case <-ctx.Done():
 | |
| 		return true
 | |
| 	default:
 | |
| 		return false
 | |
| 	}
 | |
| 	return false
 | |
| }
 |