mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-07 14:13:11 -06:00
Use gomatrixserverlib.Client for phone-home stats
This commit is contained in:
parent
2b51d978f0
commit
01ba326d83
|
|
@ -39,7 +39,7 @@ type phoneHomeStats struct {
|
||||||
cfg *config.Dendrite
|
cfg *config.Dendrite
|
||||||
db storage.Statistics
|
db storage.Statistics
|
||||||
isMonolith bool
|
isMonolith bool
|
||||||
client *http.Client
|
client *gomatrixserverlib.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
type timestampToRUUsage struct {
|
type timestampToRUUsage struct {
|
||||||
|
|
@ -55,10 +55,9 @@ func StartPhoneHomeCollector(startTime time.Time, cfg *config.Dendrite, statsDB
|
||||||
cfg: cfg,
|
cfg: cfg,
|
||||||
db: statsDB,
|
db: statsDB,
|
||||||
isMonolith: cfg.IsMonolith,
|
isMonolith: cfg.IsMonolith,
|
||||||
client: &http.Client{
|
client: gomatrixserverlib.NewClient(
|
||||||
Timeout: time.Second * 30,
|
gomatrixserverlib.WithTimeout(time.Second * 30),
|
||||||
Transport: http.DefaultTransport,
|
),
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// start initial run after 5min
|
// start initial run after 5min
|
||||||
|
|
@ -152,8 +151,7 @@ func (p *phoneHomeStats) collect() {
|
||||||
}
|
}
|
||||||
request.Header.Set("User-Agent", "Dendrite/"+internal.VersionString())
|
request.Header.Set("User-Agent", "Dendrite/"+internal.VersionString())
|
||||||
|
|
||||||
_, err = p.client.Do(request)
|
if _, err = p.client.DoHTTPRequest(ctx, request); err != nil {
|
||||||
if err != nil {
|
|
||||||
logrus.WithError(err).Error("unable to send anonymous stats")
|
logrus.WithError(err).Error("unable to send anonymous stats")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue