Ouptut memory usage

This commit is contained in:
Jonathan Cremin 2015-08-11 21:54:55 +01:00
parent 05a6f5ca06
commit eaba18d6f5
4 changed files with 27 additions and 18 deletions

View file

@ -151,6 +151,9 @@ if (!module.parent) {
app.listen(process.env.PORT || 4042, function() { app.listen(process.env.PORT || 4042, function() {
debug('Koa HTTP server listening on port ' + (process.env.PORT || 4042)); debug('Koa HTTP server listening on port ' + (process.env.PORT || 4042));
}); });
setInterval(function() {
debug('%sMB', process.memoryUsage().rss / 1024 / 1024);
}, 10000);
} }
export default app; export default app;

6
app.js
View file

@ -11,7 +11,6 @@ import { events as userEvents } from './api/routes/user';
import web from './web/app'; import web from './web/app';
import { init as storageInit } from './lib/storage'; import { init as storageInit } from './lib/storage';
import debugname from 'debug'; import debugname from 'debug';
const debug = debugname('hostr'); const debug = debugname('hostr');
@ -48,6 +47,9 @@ if (!module.parent) {
app.listen(process.env.PORT || 4040, function() { app.listen(process.env.PORT || 4040, function() {
debug('Koa HTTP server listening on port ' + (process.env.PORT || 4040)); debug('Koa HTTP server listening on port ' + (process.env.PORT || 4040));
}); });
setInterval(function() {
debug('%sMB', process.memoryUsage().rss / 1024 / 1024);
}, 10000);
} }
module.exports = app; export default app;

View file

@ -13,16 +13,16 @@
"build-js": "babel -D -m system -d web/public/build -i web/public web/public/src", "build-js": "babel -D -m system -d web/public/build -i web/public web/public/src",
"build-sass": "node-sass -r -o web/public/styles/ web/public/styles/", "build-sass": "node-sass -r -o web/public/styles/ web/public/styles/",
"cover": "istanbul cover _mocha -- --require babel/register test/**/*.spec.js", "cover": "istanbul cover _mocha -- --require babel/register test/**/*.spec.js",
"init": "node --require babel/register init.js", "init": "babel-node init.js",
"jspm": "jspm install", "jspm": "jspm install",
"start": "npm run build && node -r 'babel/register' app.js", "start": "npm run build && babel-node app.js",
"test": "mongo hostr test/fixtures/mongo-user.js test/fixtures/mongo-file.js && mocha -r babel/register test/api test/web", "test": "mongo hostr test/fixtures/mongo-user.js test/fixtures/mongo-file.js && mocha -r babel/register test/api test/web",
"watch": "nodemon -x \"node -r 'babel/register'\" app.js", "watch": "nodemon -x \"babel-node\" app.js",
"watch-js": "babel -D -w -m system -d web/public/build web/public/src", "watch-js": "babel -D -w -m system -d web/public/build web/public/src",
"watch-sass": "node-sass -w -r -o web/public/styles/ web/public/styles/" "watch-sass": "node-sass -w -r -o web/public/styles/ web/public/styles/"
}, },
"dependencies": { "dependencies": {
"aws-sdk": "~2.1.44", "aws-sdk": "~2.1.45",
"babel": "~5.8.21", "babel": "~5.8.21",
"basic-auth": "~1.0.3", "basic-auth": "~1.0.3",
"co": "~4.6.0", "co": "~4.6.0",
@ -32,11 +32,12 @@
"debug": "~2.2.0", "debug": "~2.2.0",
"ejs": "~2.3.2", "ejs": "~2.3.2",
"gm": "~1.18.1", "gm": "~1.18.1",
"heapdump": "^0.3.7",
"http-errors": "^1.3.1", "http-errors": "^1.3.1",
"jspm": "~0.16.0-beta.3", "jspm": "~0.16.0-beta.3",
"kcors": "~1.0.1", "kcors": "~1.0.1",
"koa": "~0.21.0", "koa": "~0.21.0",
"koa-bodyparser": "~2.0.0", "koa-bodyparser": "~2.0.1",
"koa-compress": "~1.0.8", "koa-compress": "~1.0.8",
"koa-csrf": "^2.3.0", "koa-csrf": "^2.3.0",
"koa-favicon": "~1.2.0", "koa-favicon": "~1.2.0",
@ -57,23 +58,23 @@
"node-sass": "~3.2.0", "node-sass": "~3.2.0",
"node-uuid": "~1.4.3", "node-uuid": "~1.4.3",
"passwords": "~1.3.0", "passwords": "~1.3.0",
"pretty-error": "^1.1.2", "pretty-error": "~1.2.0",
"raven": "~0.8.1", "raven": "~0.8.1",
"redis": "0.12.1", "redis": "0.12.1",
"redis-url": "~1.2.1", "redis-url": "~1.2.1",
"s3-upload-stream": "^1.0.7", "s3-upload-stream": "~1.0.7",
"statsy": "^0.2.0", "statsy": "^0.2.0",
"stripe": "^3.7.0", "stripe": "~3.7.0",
"swig": "^1.4.2", "swig": "~1.4.2",
"virustotal.js": "~0.3.1" "virustotal.js": "~0.3.1"
}, },
"devDependencies": { "devDependencies": {
"eslint": "~1.1.0", "eslint": "~1.1.0",
"istanbul": "^0.3.17", "istanbul": "~0.3.18",
"mocha": "~2.2.5", "mocha": "~2.2.5",
"nodemon": "~1.4.0", "nodemon": "~1.4.1",
"supertest": "~1.0.1", "supertest": "~1.0.1",
"tmp": "0.0.26" "tmp": "~0.0.27"
}, },
"jspm": { "jspm": {
"directories": { "directories": {

View file

@ -148,24 +148,27 @@ app.use(route.post('/pro/create', pro.create));
app.use(route.post('/pro/cancel', pro.cancel)); app.use(route.post('/pro/cancel', pro.cancel));
app.use(route.get('/:id', file.landing)); app.use(route.get('/:id', file.landing));
app.use(route.get('/download/:id/:name', function(id) { app.use(route.get('/download/:id/:name', function* (id) {
this.redirect('/' + id); this.redirect('/' + id);
})); }));
app.use(route.get('/file/:id/:name', file.get)); app.use(route.get('/file/:id/:name', file.get));
app.use(route.get('/files/:id/:name', file.get)); app.use(route.get('/files/:id/:name', file.get));
app.use(route.get('/file/:size/:id/:name', file.resized)); app.use(route.get('/file/:size/:id/:name', file.resized));
app.use(route.get('/updaters/mac', function() { app.use(route.get('/updaters/mac', function* () {
this.redirect('/updaters/mac.xml'); this.redirect('/updaters/mac.xml');
})); }));
app.use(route.get('/updaters/mac/changelog', function() { app.use(route.get('/updaters/mac/changelog', function* () {
this.render('mac-update-changelog'); yield this.render('mac-update-changelog');
})); }));
if (!module.parent) { if (!module.parent) {
app.listen(process.env.PORT || 4041, function() { app.listen(process.env.PORT || 4041, function() {
debug('Koa HTTP server listening on port ' + (process.env.PORT || 4041)); debug('Koa HTTP server listening on port ' + (process.env.PORT || 4041));
}); });
setInterval(function() {
debug('%sMB', process.memoryUsage().rss / 1024 / 1024);
}, 10000);
} }
export default app; export default app;