Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: Survos/thumbnail-server
base: ab54f07fe6
...
head fork: Survos/thumbnail-server
compare: 4f828c6678
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 7 additions and 4 deletions.
  1. +1 −0  config/defaults.json
  2. +6 −4 server.js
View
1  config/defaults.json
@@ -1,6 +1,7 @@
{
"basePath": "http://images.example.com",
"convertCommand": "/usr/bin/gm convert",
+ "convertTimeout": 10,
"port": 80,
"group": "www-data",
"user": "www-data",
View
10 server.js
@@ -11,6 +11,7 @@ var fs = require('fs'),
convertArguments = config.convertCommand.split(/\s+/),
convertCommand = convertArguments.shift(),
port = config.port,
+ convertTimeout = config.convertTimeout * 1000,
concurrency = config.concurrency || 1,
convertQueue;
@@ -87,10 +88,10 @@ app.get(/^(\/.+)\.([^.\/]+)(\.jpe?g)$/i, function (req, res) {
}
function cleanup() {
console.log('deleting', rawFile);
- fs.unlink(rawFile);
+ fs.unlink(rawFile, function () {});
if (convertedFile) {
console.log('deleting', convertedFile);
- fs.unlink(convertedFile);
+ fs.unlink(convertedFile, function () {});
}
}
});
@@ -139,9 +140,10 @@ function getTempFilename(options) {
}
function doConversion(task, callback) {
- var args = convertArguments.concat(task.rawFile, task.convertOptions, task.convertedFile);
+ var args = convertArguments.concat(task.rawFile, task.convertOptions, task.convertedFile),
+ execOptions = {timeout: convertTimeout};
console.log(convertCommand, args.join(' '));
- execFile(convertCommand, args, function (err, stdout, stderr) {
+ execFile(convertCommand, args, execOptions, function (err, stdout, stderr) {
if (err) {
console.log('convert error', err, stderr);
}

No commit comments for this range

Something went wrong with that request. Please try again.