mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-03 23:16:53 +00:00
Websocket reconnection fix (#541)
* Adds potential fix for websocket reconnection failure * Addr tests, we now don't return an error, this allows us to reuse existing if still in operation. * update depends && go mod tidy * adds in channel direction for parameter * Add full subscriber function, increased test coverage, initiate go routine after calling routine instance check in connection monitor * fix linter issue * use protected methods for setting field variables * removed function, added tests * lock sub manipulation * fix linter issue * Added in transport idleconnection timeout to fix MACOS reconnection issue when all idle connections are consuming resources * used protected methods to set underlying fields * set variable via time.Duration param * Added in lock around field variable in test * Addr thrasher nits and expanded exchange tests * Fix test * Addr glorious nits * go mod tidy * Add a larger timeout for traffic monitor if the test runs slow
This commit is contained in:
@@ -283,10 +283,12 @@ func (r *Requester) SetProxy(p *url.URL) error {
|
||||
return errors.New("no proxy URL supplied")
|
||||
}
|
||||
|
||||
r.HTTPClient.Transport = &http.Transport{
|
||||
Proxy: http.ProxyURL(p),
|
||||
TLSHandshakeTimeout: proxyTLSTimeout,
|
||||
t, ok := r.HTTPClient.Transport.(*http.Transport)
|
||||
if !ok {
|
||||
return errors.New("transport not set, cannot set proxy")
|
||||
}
|
||||
t.Proxy = http.ProxyURL(p)
|
||||
t.TLSHandshakeTimeout = proxyTLSTimeout
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -474,7 +474,7 @@ func TestGetNonceMillis(t *testing.T) {
|
||||
func TestSetProxy(t *testing.T) {
|
||||
t.Parallel()
|
||||
r := New("test",
|
||||
new(http.Client),
|
||||
&http.Client{Transport: new(http.Transport)},
|
||||
WithLimiter(&globalshell))
|
||||
u, err := url.Parse("http://www.google.com")
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user