mirror of
				https://github.com/go-micro/go-micro.git
				synced 2025-10-30 23:27:41 +02:00 
			
		
		
		
	hard stop if graceful stop fails after 1 second
This commit is contained in:
		| @@ -810,7 +810,18 @@ func (g *grpcServer) Start() error { | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// stop the grpc server | 		// stop the grpc server | ||||||
| 		g.srv.Stop() | 		exit := make(chan bool) | ||||||
|  |  | ||||||
|  | 		go func() { | ||||||
|  | 			g.srv.GracefulStop() | ||||||
|  | 			close(exit) | ||||||
|  | 		}() | ||||||
|  |  | ||||||
|  | 		select { | ||||||
|  | 		case <-exit: | ||||||
|  | 		case <-time.After(time.Second): | ||||||
|  | 			g.srv.Stop() | ||||||
|  | 		} | ||||||
|  |  | ||||||
| 		// close transport | 		// close transport | ||||||
| 		ch <- nil | 		ch <- nil | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user