Skip to content

Fix messy state changes on resource restart#7262

Merged
JamesNK merged 2 commits intomainfrom
jamesnk/restart-state
Jan 28, 2025
Merged

Fix messy state changes on resource restart#7262
JamesNK merged 2 commits intomainfrom
jamesnk/restart-state

Conversation

@JamesNK
Copy link
Copy Markdown
Member

@JamesNK JamesNK commented Jan 27, 2025

Description

A restarted resource's state is set to Starting when an event is raised, but deleting the resource in DCP switches it back to a terminal state, e.g. Exited. Looks messy in the dashboard.

Fix is to delete the resource and then raise the resource starting event.

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

@JamesNK JamesNK added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Jan 27, 2025
Comment thread src/Aspire.Hosting/Dcp/DcpExecutor.cs Outdated

try
{
await _executorEvents.PublishAsync(new OnResourceStartingContext(cancellationToken, resourceType, matchingResource.ModelResource, matchingResource.DcpResource.Metadata.Name)).ConfigureAwait(false);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This used to get raised for ExecutableReplicaSets before. Does it still get raised with this change?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

ExecutableReplicaSets is legacy code. It should be removed. But I'll do that in its own PR.

@danmoseley danmoseley requested a review from Copilot January 27, 2025 19:28
@JamesNK JamesNK merged commit 59aa6fc into main Jan 28, 2025
@JamesNK JamesNK deleted the jamesnk/restart-state branch January 28, 2025 00:23
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 27, 2025
@JamesNK JamesNK review requested due to automatic review settings March 23, 2026 18:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants