Skip to content

Commit

Permalink
Merge pull request #171 from oerpub/avoid-running-two-updaters-v2
Browse files Browse the repository at this point in the history
Avoid some remoteUpdater warnings
  • Loading branch information
kathi-fletcher committed Mar 13, 2014
2 parents 3a5e1cc + 8acc315 commit 34b1670
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions scripts/app.coffee
Expand Up @@ -164,18 +164,23 @@ define [
promise.resolve(val)
)
.fail (err) =>
# Probably a conflict because of a remote change.
# Possibly a conflict because of a remote change.
# Resolve the changes and save again
#
# Reload all the models (merging local changes along the way)
# and, at the same time get the new lastSeenSha
remoteUpdater.pollUpdates().then () =>
# Probably a patch/cache problem.
# Clear the cache and try again
session.getClient().clearCache?()
writeFiles(models, commitText)
.fail((err) => promise.reject(err))
.done (val) => promise.resolve(val)
# TODO: Not sure what code gihub sends back for a conflict, but it's
# gotta be one of these.
if err.status == 422 or err.status == 409
remoteUpdater.pollUpdates().then () =>
# Probably a patch/cache problem.
# Clear the cache and try again
session.getClient().clearCache?()
writeFiles(models, commitText)
.fail((err) => promise.reject(err))
.done (val) => promise.resolve(val)
else
promise.reject(err)

return promise

Expand Down

0 comments on commit 34b1670

Please sign in to comment.