mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
add metric for qpdf
This commit is contained in:
parent
a26f4fc5f6
commit
456a8ca8cd
1 changed files with 3 additions and 0 deletions
|
@ -2,6 +2,7 @@ fs = require "fs"
|
||||||
Path = require "path"
|
Path = require "path"
|
||||||
spawn = require("child_process").spawn
|
spawn = require("child_process").spawn
|
||||||
logger = require "logger-sharelatex"
|
logger = require "logger-sharelatex"
|
||||||
|
Metrics = require "./Metrics"
|
||||||
_ = require "underscore"
|
_ = require "underscore"
|
||||||
|
|
||||||
module.exports = OutputFileOptimiser =
|
module.exports = OutputFileOptimiser =
|
||||||
|
@ -19,6 +20,7 @@ module.exports = OutputFileOptimiser =
|
||||||
args = ["--linearize", src, tmpOutput]
|
args = ["--linearize", src, tmpOutput]
|
||||||
logger.log args: args, "running qpdf command"
|
logger.log args: args, "running qpdf command"
|
||||||
|
|
||||||
|
timer = new Metrics.Timer("qpdf")
|
||||||
proc = spawn("qpdf", args)
|
proc = spawn("qpdf", args)
|
||||||
stdout = ""
|
stdout = ""
|
||||||
proc.stdout.on "data", (chunk) ->
|
proc.stdout.on "data", (chunk) ->
|
||||||
|
@ -28,6 +30,7 @@ module.exports = OutputFileOptimiser =
|
||||||
logger.warn {err, args}, "qpdf failed"
|
logger.warn {err, args}, "qpdf failed"
|
||||||
callback(null) # ignore the error
|
callback(null) # ignore the error
|
||||||
proc.on "close", (code) ->
|
proc.on "close", (code) ->
|
||||||
|
timer.done()
|
||||||
if code != 0
|
if code != 0
|
||||||
logger.warn {code, args}, "qpdf returned error"
|
logger.warn {code, args}, "qpdf returned error"
|
||||||
return callback(null) # ignore the error
|
return callback(null) # ignore the error
|
||||||
|
|
Loading…
Reference in a new issue