alphabetically order apiFiles before PUT #373
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Corresponds to bug #371. All revisions should be deployed.
Currently, the APIs are deployed in random order, so revision 2 can be deployed before revision 1, which causes rev 1 to be missed.
Alphabetically ordering the API files prior to the PUT requests ensures that the list of files fed to .ForEachParallel is set in the correct order - v3 will come after v2 and v1/original, and rev3 will come after rev2 and rev1, so on and so forth.
I deployed the SampleArtifacts with an additional Swagger Petstore API to demonstrate the initial issue:
The same APIs have all revisions deployed after the change, with correct isCurrent and isOnline properties:
@waelkdouh and @guythetechie
The
.ForEachParallel
on line 387 ofApi.cs
in the publisher means that the APIs can still be deployed in incorrect order. While the list itself that is fed to.ForEachParallel
is in now in the correct order, the parallel nature of the executions may result in order issues. In the deployment logs below, you can see that the PUT request formyversionedapi-v2
occurred before the PUT formyversionedapi
.Updating the
.ForEachParallel
to a.ForEach
ensures the PUT requests are made in the correct order. I have deployed using.ForEachParallel
many times and have not been able to actually cause an error or any deployment issues, though the version order can be incorrect, so I haven't made any updates here.The logs before the change were as follows:
The logs after the change were as follows:
If I change .ForEachParallel to .ForEach: