Fix to fix to e5f73a3

This commit is contained in:
David Greenspan
2015-02-09 21:54:57 -08:00
parent 0cef7aef20
commit c0a9601abf
2 changed files with 10 additions and 11 deletions

View File

@@ -88,8 +88,13 @@ catalog.refreshOrWarn = function (options) {
catalog.runAndRetryWithRefreshIfHelpful = function (attempt) {
buildmessage.assertInJob();
var canRetry = ! (catalog.triedToRefreshRecently ||
catalog.official.offline);
// Run `attempt` in a nested buildmessage context.
var messages = buildmessage.capture(attempt);
var messages = buildmessage.capture(function () {
attempt(canRetry);
});
// Did it work? Great.
if (! messages.hasMessages()) {
@@ -100,9 +105,7 @@ catalog.runAndRetryWithRefreshIfHelpful = function (attempt) {
// related to that, or because we tried to refresh recently, or because we're
// not allowed to refresh? Fail, merging the result of these errors into the
// current job.
if (! messages.hasMessageWithTag('refreshCouldHelp') ||
catalog.triedToRefreshRecently ||
catalog.official.offline) {
if (! (messages.hasMessageWithTag('refreshCouldHelp') && canRetry)) {
buildmessage.mergeMessagesIntoCurrentJob(messages);
return;
}
@@ -131,7 +134,7 @@ catalog.runAndRetryWithRefreshIfHelpful = function (attempt) {
}
// Try again, this time directly in the current buildmessage job.
attempt();
attempt(false); // canRetry = false
};
// As a work-around for [] !== [], we use a function to check whether values are acceptable

View File

@@ -396,11 +396,9 @@ _.extend(ProjectContext.prototype, {
var anticipatedPrereleases = self._getAnticipatedPrereleases(
depsAndConstraints.constraints, cachedVersions);
var isFirstAttempt = true;
// Nothing before this point looked in the official or project catalog!
// However, the resolver does, so it gets run in the retry context.
catalog.runAndRetryWithRefreshIfHelpful(function () {
catalog.runAndRetryWithRefreshIfHelpful(function (canRetry) {
buildmessage.enterJob("selecting package versions", function () {
var resolver = self._buildResolver();
@@ -415,7 +413,7 @@ _.extend(ProjectContext.prototype, {
// of it yet. It's not actually fatal, though, for previousSolution
// to refer to package versions that we don't have access to or don't
// exist. They'll end up getting changed or removed if possible.
missingPreviousVersionIsError: isFirstAttempt
missingPreviousVersionIsError: canRetry
};
if (self._upgradePackageNames)
resolveOptions.upgrade = self._upgradePackageNames;
@@ -448,8 +446,6 @@ _.extend(ProjectContext.prototype, {
self._completedStage = STAGE.RESOLVE_CONSTRAINTS;
});
isFirstAttempt = false;
});
},