Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/filesystem/io.js

Issue 5713134241185792: Issue 337 - Race condition preventing initialization on first run (Closed)
Patch Set: Created April 16, 2014, 9:45 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/storage/io.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/filesystem/io.js
===================================================================
--- a/lib/filesystem/io.js
+++ b/lib/filesystem/io.js
@@ -181,22 +181,26 @@ var IO = exports.IO =
exists: true,
isDirectory: false,
isFile: true,
lastModified: 0
}));
return;
}
- this._getFileEntry(file, false, function(fs, fileEntry)
- {
- fileEntry.getMetadata(function(metadata)
+ // This needs to use Utils.runAsync(), otherwise FilterStorage might
+ // initialize too early - see #337.
+ require("utils").Utils.runAsync(function() {
+ this._getFileEntry(file, false, function(fs, fileEntry)
{
- callback(null, {
- exists: true,
- isDirectory: fileEntry.isDirectory,
- isFile: fileEntry.isFile,
- lastModified: metadata.modificationTime.getTime()
- });
+ fileEntry.getMetadata(function(metadata)
+ {
+ callback(null, {
+ exists: true,
+ isDirectory: fileEntry.isDirectory,
+ isFile: fileEntry.isFile,
+ lastModified: metadata.modificationTime.getTime()
+ });
+ }, callback);
}, callback);
- }, callback);
+ }.bind(this));
}
};
« no previous file with comments | « no previous file | lib/storage/io.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld