This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Exit signal gets its own trait #433
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7b121b2
Exit signal gets its own trait
arkpar f079063
Merge branch 'master' into a-exit-fix
arkpar 2d874b2
Typo
arkpar 30a54b0
Merge branch 'master' of github.com:paritytech/polkadot into a-exit-fix
arkpar 1b24a89
Merge branch 'a-exit-fix' of github.com:paritytech/polkadot into a-ex…
arkpar 8df7923
Merge branch 'master' into a-exit-fix
rphmeier 68f5053
Removed clone bounds
arkpar 283374c
Merge branch 'a-exit-fix' of github.com:paritytech/polkadot into a-ex…
arkpar 1fef54b
Merge branch 'master' into a-exit-fix
pepyakin 91ef2cf
Merge branch 'master' into a-exit-fix
arkpar 86cc4f4
Merge branch 'master' into a-exit-fix
arkpar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,11 +38,9 @@ mod vergen { | |
|
|
||
| // the regular polkadot worker simply does nothing until ctrl-c | ||
| struct Worker; | ||
| impl cli::Worker for Worker { | ||
| type Work = Self::Exit; | ||
| impl cli::IntoExit for Worker { | ||
| type Exit = future::MapErr<oneshot::Receiver<()>, fn(oneshot::Canceled) -> ()>; | ||
|
|
||
| fn exit_only(&self) -> Self::Exit { | ||
| fn into_exit(self) -> Self::Exit { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice! |
||
| // can't use signal directly here because CtrlC takes only `Fn`. | ||
| let (exit_send, exit) = oneshot::channel(); | ||
|
|
||
|
|
@@ -55,9 +53,13 @@ impl cli::Worker for Worker { | |
|
|
||
| exit.map_err(drop) | ||
| } | ||
| } | ||
|
|
||
| fn work<C: ServiceComponents>(self, _service: &Service<C>) -> Self::Exit { | ||
| self.exit_only() | ||
| impl cli::Worker for Worker { | ||
| type Work = <Self as cli::IntoExit>::Exit; | ||
| fn work<C: ServiceComponents>(self, _service: &Service<C>) -> Self::Work { | ||
| use cli::IntoExit; | ||
| self.into_exit() | ||
| } | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I'm not sure how it works. The second item in tuple of
Action::RunServiceis bound to beIntoExit, why it's calledworkerhere? Whyworker.configuration()works here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionreturns back the same thing that was passed toprepare_executionif it was not used.