diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-05-10 11:08:10 +0100 |
---|---|---|
committer | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-05-10 11:08:10 +0100 |
commit | 77722c5a4f5330f6fe517edc2d11bcba8c1fc274 (patch) | |
tree | 2c1da8cb54d9726e091a9e88b1386af2438322ee /userapi/util | |
parent | 1b3fa9689ca28de2337b67253089e286694c60e9 (diff) |
Back out matrix-org/dendrite#2421 by restoring `http.Client`s
This creates problems with non-HTTPS endpoints and should fix #2444.
Diffstat (limited to 'userapi/util')
-rw-r--r-- | userapi/util/phonehomestats.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/userapi/util/phonehomestats.go b/userapi/util/phonehomestats.go index e24daba6..ad93a50e 100644 --- a/userapi/util/phonehomestats.go +++ b/userapi/util/phonehomestats.go @@ -39,7 +39,7 @@ type phoneHomeStats struct { cfg *config.Dendrite db storage.Statistics isMonolith bool - client *gomatrixserverlib.Client + client *http.Client } type timestampToRUUsage struct { @@ -55,9 +55,10 @@ func StartPhoneHomeCollector(startTime time.Time, cfg *config.Dendrite, statsDB cfg: cfg, db: statsDB, isMonolith: cfg.IsMonolith, - client: gomatrixserverlib.NewClient( - gomatrixserverlib.WithTimeout(time.Second * 30), - ), + client: &http.Client{ + Timeout: time.Second * 30, + Transport: http.DefaultTransport, + }, } // start initial run after 5min @@ -151,7 +152,8 @@ func (p *phoneHomeStats) collect() { } request.Header.Set("User-Agent", "Dendrite/"+internal.VersionString()) - if _, err = p.client.DoHTTPRequest(ctx, request); err != nil { + _, err = p.client.Do(request) + if err != nil { logrus.WithError(err).Error("unable to send anonymous stats") return } |