Skip to content

Commit

Permalink
Fixed reference to build in rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmerfield committed Oct 12, 2018
1 parent 158ee34 commit 3c521a5
Showing 1 changed file with 36 additions and 29 deletions.
65 changes: 36 additions & 29 deletions app/sync/update/rebuildDependents.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
var async = require('async');
var Entry = require('entry');
var client = require('client');
var Blog = require('blog');
var async = require("async");
var build = require("../../build");
var Entry = require("entry");
var client = require("client");
var Blog = require("blog");

var dependentsKey = Entry.key.dependents;

Expand All @@ -10,32 +11,38 @@ var dependentsKey = Entry.key.dependents;
// on the contents of this particular file which was
// just changed or removed.

module.exports = function (blogID, path, callback) {

Blog.get({id: blogID}, function(err, blog){

client.SMEMBERS(dependentsKey(blogID, path), function(err, dependent_paths){

module.exports = function(blogID, path, callback) {
Blog.get({ id: blogID }, function(err, blog) {
client.SMEMBERS(dependentsKey(blogID, path), function(
err,
dependent_paths
) {
if (err) return callback(err);

async.eachSeries(dependent_paths, function(dependent_path, next){

Entry.build(blog, dependent_path, function(err, updated_dependent){

if (err) {
console.log('Error rebuilding dependents:', path, err);
return next();
}

Entry.set(blogID, dependent_path, updated_dependent, function(err){

if (err) return callback(err);

next();

}, false);
});
}, callback);
async.eachSeries(
dependent_paths,
function(dependent_path, next) {
build(blog, dependent_path, function(err, updated_dependent) {
if (err) {
console.log("Error rebuilding dependents:", path, err);
return next();
}

Entry.set(
blogID,
dependent_path,
updated_dependent,
function(err) {
if (err) return callback(err);

next();
},
false
);
});
},
callback
);
});
});
};
};

0 comments on commit 3c521a5

Please sign in to comment.