Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed concurrency bug with bootstrapping

  • Loading branch information...
commit c024905d98c932f25b001e1a45fd505651ef6d3d 1 parent 84af618
@chetan51 authored
Showing with 12 additions and 7 deletions.
  1. +12 −7 lib/ni.js
View
19 lib/ni.js
@@ -363,15 +363,19 @@ function bootStrapViews(__root, callback) {
var __views = __root + '/views';
var views = {};
- loadFilesFromDir(__views, function(dir, file, name) {
+ loadFilesFromDir(__views, function(dir, file, name, callback) {
var view = {};
view.path = dir + '/' + file;
fs.readFile(view.path, 'utf-8', function(err, data) {
-
- view.template = data;
- views[name] = view;
+
+ if (err) callback(err);
+ else {
+ view.template = data;
+ views[name] = view;
+ callback(null);
+ }
});
@@ -409,10 +413,12 @@ function bootStrapModules(__root, callback) {
var __modules = __root;
var modules = {};
- loadFilesFromDir(__modules, function(dir, file, name) {
+ loadFilesFromDir(__modules, function(dir, file, name, callback) {
var name = file.split('.')[0];
modules[name] = require(dir + '/' + file);
+
+ callback();
}, function(err) {
@@ -442,8 +448,7 @@ function loadFilesFromDir(dir, fnOnFile, callback) {
if (! /~$/.test(file)) {
var name = file.split('.')[0];
- fnOnFile(dir, file, name);
- group()();
+ fnOnFile(dir, file, name, group());
}
});
}
Please sign in to comment.
Something went wrong with that request. Please try again.