Skip to content

Commit

Permalink
Merge pull request inventid#75 from inventid/log_render_time
Browse files Browse the repository at this point in the history
Log the render time
  • Loading branch information
rogierslag authored Jul 5, 2016
2 parents fea3595 + 1cc2dc1 commit fbb4d89
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions create-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ git pull > /dev/null
echo "Whats the version number associated with this release? Type the version number followed by [enter]. "
read VERSION

npm version $VERSION
git checkout master > /dev/null
git pull > /dev/null
git rebase develop > /dev/null
Expand Down
1 change: 1 addition & 0 deletions migrations/20160705120249.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE images ADD COLUMN rendered_at TIMESTAMPTZ default null;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iaas",
"version": "0.1.0",
"version": "0.1.3",
"description": "ImageMagick as a HTTP service, using AWS S3 to store caches",
"main": "src/index.js",
"dependencies": {
Expand Down
5 changes: 3 additions & 2 deletions src/dbCache.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import log from "./log";

const insertImage = 'INSERT INTO images (id, x, y, fit, file_type, url, blur) VALUES ($1,$2,$3,$4,$5,$6,$7)';
const insertImage = 'INSERT INTO images (id, x, y, fit, file_type, url, blur, rendered_at) VALUES ($1,$2,$3,$4,$5,$6,$7,$8)';
const selectImage = 'SELECT url FROM images WHERE id=$1 AND x=$2 AND y=$3 AND fit=$4 AND file_type=$5 AND blur=$6';

export default (db) => {
Expand Down Expand Up @@ -37,7 +37,8 @@ export default (db) => {
params.fit,
params.mime,
url,
Boolean(params.blur)
Boolean(params.blur),
new Date()
];

try {
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const uploadImage = async(req, res) => {
const name = req.params.name;
log('info', `Requested image upload for image_id ${name} with token ${sentToken}`);

const canConsumeToken = token(db).consume(sentToken, name);
const canConsumeToken = await token(db).consume(sentToken, name);
if (!canConsumeToken) {
res.status(403).end();
return;
Expand Down

0 comments on commit fbb4d89

Please sign in to comment.