Skip to content

Commit 04cdefb

Browse files
author
Ilya Radchenko
committed
fix: log error if bad mongo connection, resolves #997
Small tweaks
1 parent 9948980 commit 04cdefb

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

lib/app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ exports.init = function (config) {
5959

6060
mongoose.connect(mongodbUrl, function (error) {
6161
if (error) {
62-
debug('Could not connect to DB: %s', error);
62+
console.log('Could not connect to DB: %s', error);
6363
process.exit(1);
6464
}
6565
});

lib/email.js

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ var text = loadTemplates(templates, 'plaintext');
2323
/*
2424
* loading all of the email templates at server start
2525
*/
26-
2726
function loadTemplates(list, type) {
2827
if (!list) {
2928
return;

lib/humane.js

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
*/
1515

1616
exports.humaneDate = function humaneDate(date, compareTo) {
17-
1817
if (!date) {
1918
return;
2019
}

lib/jobs.js

+19-9
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,31 @@ module.exports = {
88
small: small
99
};
1010

11+
var async = require('async');
1112
var Job = require('./models').Job;
1213
var User = require('./models').User;
1314
var Project = require('./models').Project;
1415
var utils = require('./utils');
15-
var async = require('async');
1616

1717
var TEST_ONLY = 'TEST_ONLY';
1818

19-
// user: user object
20-
// small: if true, "phases" and "std" will not be fetched for the jobs
21-
// - dramatically reducing the size of the object.
22-
// TODO: add paging
23-
// done(err, {yours: [...], public: [...]})
19+
/**
20+
* user: user object
21+
* small: if true, "phases" and "std" will not be fetched for the jobs
22+
* - dramatically reducing the size of the object.
23+
* TODO: add paging
24+
* done(err, {yours: [...], public: [...]})
25+
*
26+
* @param {Object} user
27+
* @param {Boolean} small
28+
* @param {Function} done
29+
*/
2430
function latestJobs(user, small, done) {
2531
if (arguments.length === 2) {
2632
done = small;
2733
small = false;
2834
}
29-
var tasks = {public: latestPublicJobs.bind(null, user, small)};
35+
var tasks = { public: latestPublicJobs.bind(null, user, small) };
3036
if (user) {
3137
tasks.yours = latestUsersJobs.bind(null, user, small);
3238
}
@@ -75,10 +81,14 @@ function latestJob(project, user, small, done) {
7581
.sort({finished: -1})
7682
.limit(6)
7783
.lean();
78-
if (small) query = query.select('-phases -std');
84+
85+
if (small) {
86+
query = query.select('-phases -std');
87+
}
88+
7989
query.exec(function (err, jobs) {
8090
if (!jobs || !jobs.length) {
81-
return done(err, {nojobs: true, project: jobProject(project, [], user)});
91+
return done(err, { nojobs: true, project: jobProject(project, [], user) });
8292
}
8393
var job = jobs[0];
8494
job.project = jobProject(project, jobs.slice(1));

0 commit comments

Comments
 (0)