Permalink
Browse files

Late prep once we have routes and some debug

  • Loading branch information...
1 parent 2df3790 commit 74b5093b9a2ec11af248334ab0e554f0d5f36e57 @temas temas committed Mar 19, 2013
Showing with 15 additions and 10 deletions.
  1. +15 −10 lib/push.js
View
@@ -27,22 +27,27 @@ exports.pump = function(cset, auth, cbDone) {
// extract all the bases into clumps
var bases = {};
var oembeds = {};
- cset.forEach(function(entry) {
- var base = idr.toString(idr.base(entry.idr));
- // index the oembeds for easy lookup, and skip them from pushing
- if (base === 'oembed:links/oembed') {
- oembeds[entry.idr] = entry;
- return;
- }
- if (!bases[base]) bases[base] = [];
- if (entry.saved) bases[base].push(entry); // only new entries have a .hash
- });
+ console.log("Checking routes");
// and begins our async cascade
getRoutes(auth, function(routes) {
+ console.log("Got routes %j", routes);
if (Object.keys(routes).length === 0) {
return cbDone(null, cset);
}
+
+ // Let's prep now that we have routes
+ cset.forEach(function(entry) {
+ var base = idr.toString(idr.base(entry.idr));
+ // index the oembeds for easy lookup, and skip them from pushing
+ if (base === 'oembed:links/oembed') {
+ oembeds[entry.idr] = entry;
+ return;
+ }
+ if (!bases[base]) bases[base] = [];
+ if (entry.saved) bases[base].push(entry); // only new entries have a .hash
+ });
+
// do each isolated clustering in parallel
logger.debug("ROUTES",routes);
logger.debug("BASES",bases);

0 comments on commit 74b5093

Please sign in to comment.