From 5db262bfce6b4cd5d98953edb68bd41433626470 Mon Sep 17 00:00:00 2001 From: HarrisChu <1726587+HarrisChu@users.noreply.github.com> Date: Thu, 4 Jan 2024 18:11:35 +0800 Subject: [PATCH] support http2 --- pkg/common/types.go | 1 + pkg/nebulagraph/client.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/pkg/common/types.go b/pkg/common/types.go index ad2b4aa..5435c85 100644 --- a/pkg/common/types.go +++ b/pkg/common/types.go @@ -68,6 +68,7 @@ type ( Username string `json:"username"` Password string `json:"password"` Space string `json:"space"` + UseHttp bool `json:"use_http"` } OutputOption struct { diff --git a/pkg/nebulagraph/client.go b/pkg/nebulagraph/client.go index c650adc..250cefb 100644 --- a/pkg/nebulagraph/client.go +++ b/pkg/nebulagraph/client.go @@ -181,6 +181,10 @@ func (gp *GraphPool) initConnectionPool() error { return err } } + if gp.graphOption.UseHttp { + conf.UseHTTP2 = true + } + pool, err := graph.NewSslConnectionPool(hosts, conf, sslConfig, graph.DefaultLogger{}) if err != nil { return err @@ -217,6 +221,7 @@ func (gp *GraphPool) initSessionPool() error { graph.WithMaxSize(gp.graphOption.MaxSize), graph.WithMinSize(gp.graphOption.MinSize), graph.WithSSLConfig(sslConfig), + graph.WithHTTP2(gp.graphOption.UseHttp), ) if err != nil { return err