Skip to content

when shutdownIfNotStarted is set to false, dont shutdown items that failed to start #107

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

Merged
merged 2 commits into from
Sep 4, 2021

Conversation

tomerd
Copy link
Contributor

@tomerd tomerd commented Sep 2, 2021

motivation: improve confusing behavior

changes:

  • change startTask to return an array of started tasks instead of an index
  • only shutdown successfully started tasks or ones that have explicitly set shutdownIfNotStarted to true
  • add and adjust tests

@tomerd tomerd added this to the 1.0.0-alpha8 milestone Sep 2, 2021
@tomerd tomerd linked an issue Sep 2, 2021 that may be closed by this pull request
@tomerd
Copy link
Contributor Author

tomerd commented Sep 2, 2021

jazzy issues failing CI, need #108 first

}
// shutdown called while starting
if case .shuttingDown = self.stateLock.withLock({ self.state }) {
return callback(index, nil)
let started = index < tasks.count ? Array(tasks.prefix(index + 1)) : tasks
Copy link
Collaborator

@yim-lee yim-lee Sep 2, 2021

Choose a reason for hiding this comment

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

Why would the task at index be considered started?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is a non-error case, meaning the task was started successfully. do you see something else?

@tomerd
Copy link
Contributor Author

tomerd commented Sep 3, 2021

@weissi do you want to test this one (before we tag) to make sure it addressed your concern?

…ilaed to start

motivation: improve confusing behavior

changes:
* change startTask to return an array of started tasks instead of an index
* only shutdown successfully started tasks or ones that have explicitly set shutdownIfNotStarted to true
* add and adjust tests
@tomerd tomerd force-pushed the fix/shutdown-on-error branch from 962f824 to 2b66515 Compare September 3, 2021 21:10
@tomerd tomerd requested a review from yim-lee September 3, 2021 21:18
@tomerd tomerd merged commit 2744df5 into swift-server:main Sep 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

state machine bug: calls shutdown if start fails
2 participants