diff options
author | David Barksdale <amatus@amatus.name> | 2014-07-04 08:40:26 -0500 |
---|---|---|
committer | David Barksdale <amatus@amatus.name> | 2014-07-04 08:40:26 -0500 |
commit | 14c1d319ee068d79dfbeee5af97f1caa69778934 (patch) | |
tree | eb21cf529dee0f2d7af17e19b296eb571548504b /src | |
parent | 8989c01bc5dc61fca85b6e3e3e29d997c44493e3 (diff) |
Tweaking syncfs task
Diffstat (limited to 'src')
-rw-r--r-- | src/js/pre.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/js/pre.js b/src/js/pre.js index 0fc1e50..35321f9 100644 --- a/src/js/pre.js +++ b/src/js/pre.js @@ -54,8 +54,8 @@ gnunet_prerun = function() { // removeRunDependency("randomness") // Mount IDBFS for services that use it - var match; - if (match = location.pathname.match('gnunet-service-(.*).js')) { + var match = location.pathname.match('gnunet-service-(.*).js'); + if (match) { var service = match[1]; var mounts = {peerinfo: true, fs: true, nse: true}; if (mounts[service]) { @@ -64,8 +64,12 @@ gnunet_prerun = function() { FS.mount(IDBFS, {}, mount); addRunDependency('syncfs'); FS.syncfs(true, function() { removeRunDependency('syncfs'); }); + var syncfs_task; var sync_callback = function() { - setTimeout(function() { FS.syncfs(false, sync_callback); }, 5000); + clearTimeout(syncfs_task); + syncfs_task = setTimeout(function() { + FS.syncfs(false, sync_callback); + }, 5000); }; sync_callback(); } |