Skip to content

Commit

Permalink
Closes #7
Browse files Browse the repository at this point in the history
  • Loading branch information
cromwellryan authored and robtarr committed Apr 28, 2015
1 parent d3438c3 commit 6028cfe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions lib/dashing.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,11 @@ module.exports.Dashing = function Dashing() {
res.write('\n');
res.write(Array(2049).join(' ') + '\n'); // 2kb padding for IE
latest_events()
.done( function(events) {
res.write(events);
.then( function(events) {
if(events) {
res.write(events);
}
}).done(function() {
res.flush(); // need to flush with .compress()
});

Expand Down Expand Up @@ -190,7 +193,8 @@ module.exports.Dashing = function Dashing() {
}

function latest_events() {
return Promise.resolve(dashing.history.getAll()) // assure trusted promise
return Promise
.resolve(dashing.history.getAll()) // assure trusted promise
.reduce( function(agg, next) {
return agg + next;
});
Expand Down Expand Up @@ -223,6 +227,7 @@ module.exports.Dashing = function Dashing() {
function start_jobs() {
// Load jobs files
var job_path = process.env.JOB_PATH || [dashing.root, 'jobs'].join(path.sep);
logger.info('Searching for jobs in', job_path);
fs.readdir(job_path, function(err, files) {
if (err) throw err;
for (var i in files) {
Expand Down
2 changes: 1 addition & 1 deletion lib/inMemoryHistory.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var InMemoryHistory = module.exports = function() {
return self._event_data[key];
});

return new Promise.resolve(values);
return Promise.resolve(values);
};

return self;
Expand Down

0 comments on commit 6028cfe

Please sign in to comment.