mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-26 00:54:04 +08:00
[client-app] Record file download times
Summary: We'd like to get an idea of how long the client app is having to wait when requesting a file. Waiting can cause things like inline image attachments to appear very slow to load. Test Plan: Run locally Reviewers: evan, spang, juan Reviewed By: juan Differential Revision: https://phab.nylas.com/D4255
This commit is contained in:
parent
ce17f70f26
commit
e13d4832ff
1 changed files with 14 additions and 0 deletions
|
@ -101,7 +101,15 @@ export class Download {
|
|||
|
||||
let startRequest = null;
|
||||
|
||||
const before = Date.now();
|
||||
|
||||
const onFailed = (err) => {
|
||||
Actions.recordPerfMetric({
|
||||
action: 'file-download-failed',
|
||||
accountId: this.accountId,
|
||||
actionTimeMs: Date.now() - before,
|
||||
maxValue: 10 * 60 * 1000,
|
||||
})
|
||||
this.request = null;
|
||||
stream.end();
|
||||
if (!this.retryWithBackoff || this.attempts >= this.maxAttempts) {
|
||||
|
@ -118,6 +126,12 @@ export class Download {
|
|||
};
|
||||
|
||||
const onSuccess = () => {
|
||||
Actions.recordPerfMetric({
|
||||
action: 'file-download-succeeded',
|
||||
accountId: this.accountId,
|
||||
actionTimeMs: Date.now() - before,
|
||||
maxValue: 10 * 60 * 1000,
|
||||
})
|
||||
this.request = null;
|
||||
stream.end();
|
||||
this.state = State.Finished;
|
||||
|
|
Loading…
Reference in a new issue