From 595bfe09ac99e9daed3e3719b0c49977e42cea30 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Wed, 16 Mar 2016 15:49:13 +0000 Subject: [PATCH] add metric for qpdf --- app/coffee/OutputFileOptimiser.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/coffee/OutputFileOptimiser.coffee b/app/coffee/OutputFileOptimiser.coffee index f337a7a..eb5266e 100644 --- a/app/coffee/OutputFileOptimiser.coffee +++ b/app/coffee/OutputFileOptimiser.coffee @@ -2,6 +2,7 @@ fs = require "fs" Path = require "path" spawn = require("child_process").spawn logger = require "logger-sharelatex" +Metrics = require "./Metrics" _ = require "underscore" module.exports = OutputFileOptimiser = @@ -19,6 +20,7 @@ module.exports = OutputFileOptimiser = args = ["--linearize", src, tmpOutput] logger.log args: args, "running qpdf command" + timer = new Metrics.Timer("qpdf") proc = spawn("qpdf", args) stdout = "" proc.stdout.on "data", (chunk) -> @@ -28,6 +30,7 @@ module.exports = OutputFileOptimiser = logger.warn {err, args}, "qpdf failed" callback(null) # ignore the error proc.on "close", (code) -> + timer.done() if code != 0 logger.warn {code, args}, "qpdf returned error" return callback(null) # ignore the error