mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-25 00:25:03 +08:00
[client-app] Measure and report sending times
Summary: See title Test Plan: manual Reviewers: spang, halla, evan Reviewed By: halla, evan Differential Revision: https://phab.nylas.com/D4014
This commit is contained in:
parent
4c57fcfab4
commit
ae9aede300
1 changed files with 24 additions and 0 deletions
|
@ -32,6 +32,14 @@ export default class SendDraftTask extends BaseDraftTask {
|
|||
return "Sending message";
|
||||
}
|
||||
|
||||
performLocal() {
|
||||
return super.performLocal()
|
||||
.then(() => {
|
||||
this._timerKey = `send-draft-${this.draftClientId}`
|
||||
NylasEnv.timer.start(this._timerKey)
|
||||
})
|
||||
}
|
||||
|
||||
performRemote() {
|
||||
return this.refreshDraftReference()
|
||||
.then(this.assertDraftValidity)
|
||||
|
@ -198,10 +206,26 @@ export default class SendDraftTask extends BaseDraftTask {
|
|||
if (this.playSound && NylasEnv.config.get("core.sending.sounds")) {
|
||||
SoundRegistry.playSound('send');
|
||||
}
|
||||
if (NylasEnv.timer.isPending(this._timerKey)) {
|
||||
Actions.recordPerfMetric({
|
||||
action: 'send-draft',
|
||||
actionTimeMs: NylasEnv.timer.stop(this._timerKey),
|
||||
maxValue: 60 * 1000,
|
||||
succeeded: true,
|
||||
})
|
||||
}
|
||||
return Promise.resolve(Task.Status.Success);
|
||||
}
|
||||
|
||||
onError = (err) => {
|
||||
if (NylasEnv.timer.isPending(this._timerKey)) {
|
||||
Actions.recordPerfMetric({
|
||||
action: 'send-draft',
|
||||
actionTimeMs: NylasEnv.timer.stop(this._timerKey),
|
||||
maxValue: 60 * 1000,
|
||||
succeeded: false,
|
||||
})
|
||||
}
|
||||
if (err instanceof BaseDraftTask.DraftNotFoundError) {
|
||||
return Promise.resolve(Task.Status.Continue);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue