Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return restore task on nomination #989

Merged
merged 1 commit into from
Nov 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ public interface IVsSolutionRestoreService
/// <param name="projectRestoreInfo">Metadata <see cref="IVsProjectRestoreInfo"/> needed for restoring the project.</param>
/// <param name="token">Cancellation token.</param>
/// <returns>
/// Returns if the requested nuget restore operation for the given project
/// was a success or failure.
/// Returns a restore task corresponding to the nominated project request.
/// NuGet will batch restore requests so it's possible the same restore task will be returned for multiple projects.
/// When the requested restore operation for the given project completes the task will indicate operation success or failure.
/// </returns>
Task<bool> NominateProjectAsync(string projectUniqueName, IVsProjectRestoreInfo projectRestoreInfo, CancellationToken token);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public VsSolutionRestoreService(

public Task<bool> CurrentRestoreOperation => _restoreWorker.CurrentRestoreOperation;

public async Task<bool> NominateProjectAsync(string projectUniqueName, IVsProjectRestoreInfo projectRestoreInfo, CancellationToken token)
public Task<bool> NominateProjectAsync(string projectUniqueName, IVsProjectRestoreInfo projectRestoreInfo, CancellationToken token)
{
if (string.IsNullOrEmpty(projectUniqueName))
{
Expand Down Expand Up @@ -111,12 +111,11 @@ public async Task<bool> NominateProjectAsync(string projectUniqueName, IVsProjec
_projectSystemCache.AddProjectRestoreInfo(projectNames, packageSpec);

// returned task completes when scheduled restore operation completes.
// it should be discarded as we don't want to block CPS on that.
var ignored = _restoreWorker.ScheduleRestoreAsync(
var restoreTask = _restoreWorker.ScheduleRestoreAsync(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the restoreTask returned is the same when two nominate call are made without a restore between them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct.

SolutionRestoreRequest.OnUpdate(),
token);

return await System.Threading.Tasks.Task.FromResult(true);
return restoreTask;
}
catch (Exception e)
{
Expand Down