Permalink
Browse files

Set lastMod in the right order to prevent endless loop

  • Loading branch information...
1 parent d21701b commit 0434e9b478df8bebbba4c00ed8e6934976f88d87 @kriszyp kriszyp committed Feb 4, 2010
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/store/js-file.js
View
5 lib/store/js-file.js
@@ -23,17 +23,18 @@ exports.JSFile = function(filename){
var fileTime = stat.mtime.getTime();
if(fileTime > lastMod){
lastMod = fileTime;
- store.setIndex(JSONExt.parse(File.read(filename)));
+ var data = JSONExt.parse(File.read(filename));
+ store.setIndex(data);
}
}
else if(lastMod === 0){
+ lastMod = 1; // just read it once in node
// node goes in here right now
try{
store.setIndex(JSONExt.parse(File.read(filename).wait()));
}catch(e){
// if it doesn't exist, node throws an error
}
- lastMod = 1; // just read it once in node
}
return {

0 comments on commit 0434e9b

Please sign in to comment.