File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -1871,6 +1871,24 @@ func TestReaderClose(t *testing.T) {
18711871	}
18721872}
18731873
1874+ func  BenchmarkReaderClose (b  * testing.B ) {
1875+ 	r  :=  NewReader (ReaderConfig {
1876+ 		Brokers : []string {"localhost:9092" },
1877+ 		Topic :   makeTopic (),
1878+ 		MaxWait : 2  *  time .Second ,
1879+ 	})
1880+ 	defer  r .Close ()
1881+ 	for  i  :=  0 ; i  <  b .N ; i ++  {
1882+ 		ctx , cancel  :=  context .WithTimeout (context .Background (), time .Second )
1883+ 		defer  cancel ()
1884+ 
1885+ 		_ , err  :=  r .FetchMessage (ctx )
1886+ 		if  err  !=  context .DeadlineExceeded  {
1887+ 			b .Errorf ("bad err: %v" , err )
1888+ 		}
1889+ 	}
1890+ }
1891+ 
18741892// writeMessagesForCompactionCheck writes messages with specific writer configuration. 
18751893func  writeMessagesForCompactionCheck (t  * testing.T , topic  string , msgs  []Message ) {
18761894	t .Helper ()
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments