From 1b4209ed377784835befe19582072239e11d19ff Mon Sep 17 00:00:00 2001 From: Juan Tejada Date: Tue, 27 Sep 2016 08:42:25 -0700 Subject: [PATCH] fix(tasks): Add instrumentation to Task's performLocal A slow performLocal may be one of the causes of #2725 --- src/flux/stores/task-queue.coffee | 8 +++++++- src/nylas-env.coffee | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/flux/stores/task-queue.coffee b/src/flux/stores/task-queue.coffee index 788dcf23f..08d943b99 100644 --- a/src/flux/stores/task-queue.coffee +++ b/src/flux/stores/task-queue.coffee @@ -137,7 +137,13 @@ class TaskQueue task.sequentialId = ++@_currentSequentialId @_dequeueObsoleteTasks(task) - task.runLocal().then => + runLocalStart = Date.now() + task.runLocal() + .then => + runLocalTime = Date.now() - runLocalStart + if runLocalTime >= 150 + err = new Error("Task peformLocal took more than 150ms") + NylasEnv.reportError(err, {task: task.toJSON(), duration: runLocalTime, taskName: task.constructor.name}) @_queue.push(task) @_updateSoon() diff --git a/src/nylas-env.coffee b/src/nylas-env.coffee index 723f3abd2..fb8fda82d 100644 --- a/src/nylas-env.coffee +++ b/src/nylas-env.coffee @@ -278,7 +278,7 @@ class NylasEnvConstructor jasmine.getEnv().currentSpec.fail(error) else if @inDevMode() and not noWindows @openDevTools() - @executeJavaScriptInDevTools('DevToolsAPI.showConsole()') + @executeJavaScriptInDevTools("DevToolsAPI.showPanel('console')") @errorLogger.reportError(error, extra)