fix(tasks): Add instrumentation to Task's performLocal

A slow performLocal may be one of the causes of #2725
This commit is contained in:
Juan Tejada 2016-09-27 08:42:25 -07:00
parent 2af6eb7be3
commit 1b4209ed37
2 changed files with 8 additions and 2 deletions

View file

@ -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()

View file

@ -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)