Skip to content

Commit 1787f44

Browse files
committed
cleanup
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
1 parent 1bbdf03 commit 1787f44

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ module github.com/unistack-org/micro-client-http/v3
22

33
go 1.16
44

5-
require github.com/unistack-org/micro/v3 v3.2.26
5+
require github.com/unistack-org/micro/v3 v3.3.0

go.sum

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
55
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
66
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
77
github.com/silas/dag v0.0.0-20210121180416-41cf55125c34/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I=
8-
github.com/unistack-org/micro/v3 v3.2.26/go.mod h1:iJwCWq2PECMxigfqe6TPC5GLWvj6P94Kk+PTVZGL3w8=
8+
github.com/unistack-org/micro/v3 v3.3.0 h1:pEj/8QVFzMlNMEL//q/Te8qgG+XI6LTYIQrb6hMymgk=
9+
github.com/unistack-org/micro/v3 v3.3.0/go.mod h1:iJwCWq2PECMxigfqe6TPC5GLWvj6P94Kk+PTVZGL3w8=
910
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
1011
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
1112
golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=

http.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ type httpClient struct {
3434
opts client.Options
3535
dialer *net.Dialer
3636
httpcli *http.Client
37+
init bool
3738
}
3839

3940
func newRequest(addr string, req client.Request, ct string, cf codec.Codec, msg interface{}, opts client.CallOptions) (*http.Request, error) {
@@ -217,9 +218,32 @@ func (h *httpClient) newCodec(ct string) (codec.Codec, error) {
217218
}
218219

219220
func (h *httpClient) Init(opts ...client.Option) error {
221+
if len(opts) == 0 && h.init {
222+
return nil
223+
}
220224
for _, o := range opts {
221225
o(&h.opts)
222226
}
227+
228+
if err := h.opts.Broker.Init(); err != nil {
229+
return err
230+
}
231+
if err := h.opts.Tracer.Init(); err != nil {
232+
return err
233+
}
234+
if err := h.opts.Router.Init(); err != nil {
235+
return err
236+
}
237+
if err := h.opts.Logger.Init(); err != nil {
238+
return err
239+
}
240+
if err := h.opts.Meter.Init(); err != nil {
241+
return err
242+
}
243+
if err := h.opts.Transport.Init(); err != nil {
244+
return err
245+
}
246+
223247
return nil
224248
}
225249

0 commit comments

Comments
 (0)