From 94a1dfd90d8f9052e23dc5b4448f7f11c9bc7b98 Mon Sep 17 00:00:00 2001 From: Jeff Morgan Date: Thu, 28 Aug 2014 22:21:34 -0700 Subject: [PATCH] Fixing sync problems --- meteor/client/lib/sync.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/meteor/client/lib/sync.js b/meteor/client/lib/sync.js index 19d24ffa9e..4dbbcace5d 100644 --- a/meteor/client/lib/sync.js +++ b/meteor/client/lib/sync.js @@ -20,15 +20,14 @@ addAppWatcher = function (app) { var vmPath = 'ssh://docker@localhost:2022/' + vmDir; var watcher = chokidar.watch(appPath, {ignored: /.*\.DS_Store/}); var syncing = false; + var willSyncAgain = false; var syncFunc = function (event, changedPath) { if (syncing) { + willSyncAgain = true; return; } syncing = true; - // Make sure that if they delete the app_name folder under ~/Kitematic, we don't delete all the volumes. - // Deleting files inside the app_name folder _will_ delete the volumes. - var errorPattern = /The\sfile\s(.*)\son\shost/g; var archiveErrorPattern = /Archive\s(.*)\son\shost\s.*\sshould\sbe\sDELETED/g; var cmd = path.join(getBinDir(), 'unison'); @@ -79,6 +78,10 @@ addAppWatcher = function (app) { // console.error(e); } syncing = false; + if (willSyncAgain) { + syncFunc(); + willSyncAgain = false; + } }); }; @@ -110,9 +113,9 @@ resolveWatchers = function (callback) { }); // Run a sync for 'pulling' changes in the volumes. - /*_.each(watchers, function (watcher) { + _.each(watchers, function (watcher) { watcher.sync(); - });*/ + }); callback(); }; \ No newline at end of file