func()

in server/internal/server/server.go [116:145]


func (s *Server) IsRunning() bool {
	timeout := 1 * time.Second

	grpcAddress := net.JoinHostPort("localhost", strconv.Itoa(s.GrpcPort))
	httpAddress := net.JoinHostPort("localhost", strconv.Itoa(s.HttpPort))

	// Check gRPC port
	grpcConn, err := net.DialTimeout("tcp", grpcAddress, timeout)
	if err != nil {
		return false
	}
	if grpcConn != nil {
		defer grpcConn.Close()
	} else {
		return false
	}

	// Check HTTP port
	httpConn, err := net.DialTimeout("tcp", httpAddress, timeout)
	if err != nil {
		return false
	}
	if httpConn != nil {
		defer httpConn.Close()
	} else {
		return false
	}

	return true
}