Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fixes #43866 configurable stop signals for messenger#44305

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed

Conversation

@Warxcell
Copy link
Contributor

@WarxcellWarxcell commentedNov 27, 2021
edited
Loading

QA
Branch?6.1
Bug fix?yes
New feature?yes
Deprecations?yes
TicketsFix#43866
LicenseMIT
Doc PRsymfony/symfony-docs# TODO

@carsonbot
Copy link

Hey!

I think@ruudk has recently worked with this code. Maybe they can help review this?

Cheers!

Carsonbot

Copy link
Contributor

@ruudkruudk left a comment

Choose a reason for hiding this comment

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

Looks great, added a few comments.

@@ -1,5 +1,6 @@
framework:
messenger:
stop_signals:SIGTERM
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does this have to be plural (a list of signals) instead of just 1 signal?

Suggested change
stop_signals:SIGTERM
stop_signal:SIGTERM

Copy link
ContributorAuthor

@WarxcellWarxcellNov 28, 2021
edited
Loading

Choose a reason for hiding this comment

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

in case project is used in several envs (docker FPM alpine environment, and classical VMs/bare-metal with supervisor) where signals could be different.

Copy link
Contributor

Choose a reason for hiding this comment

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

Then configure the correct signal for that env. Doesn't make sense (to me) to just fire all the signals.

Copy link
Member

Choose a reason for hiding this comment

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

Agreed with@Warxcell. we should allow multiple signals.

Comment on lines 35 to 45
privatefunctionstrsignal(int$signal):string
{
foreach (get_defined_constants(true)['pcntl']as$name =>$num) {
// the _ is to ignore SIG_IGN and SIG_DFL and SIG_ERR and SIG_BLOCK and SIG_UNBLOCK and SIG_SETMARK, and maybe more, who knows
if ($num ===$signal &&'SIG' ===substr($name,0,3) &&'_' !==$name[3]) {
return$name;
}
}

thrownew \InvalidArgumentException(sprintf('The signal "%d" is not valid.',$signal));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I would move this responsibility to the compilation/configuration step and just always have the signal int injected via the constructor.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

this is the case, but for logger, we need the name of the signal - so I need to reverse the logic - get the signal name by its id (int)

@jderussejderusse modified the milestones:6.0,6.1Nov 28, 2021
Copy link
Member

@jderussejderusse left a comment

Choose a reason for hiding this comment

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

for 6.1 as it's a new feature

->children()
->arrayNode('stop_signals')
->beforeNormalization()
->ifString()->then(staticfn (string$value):int =>constant($value))
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't we check of the constant exists and is a supported signal?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

if constant doesn't exists - it will return null, and will be caught at validate. About supported signal, it's checked inside the Listeners itself.

->then(staticfunction (array$v):void {thrownewInvalidConfigurationException(sprintf('The specified default bus "%s" is not configured. Available buses are "%s".',$v['default_bus'],implode('", "',array_keys($v['buses'])))); })
->end()
->children()
->arrayNode('stop_signals')
Copy link
Member

Choose a reason for hiding this comment

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

For lists, you should addfixXmlConfig

useSymfony\Component\Workflow\WorkflowEvents;

usefunctionarray_keys;
usefunctionconstant;
Copy link
Member

Choose a reason for hiding this comment

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

do not import functions please.

->tag('kernel.event_subscriber')
->tag('monolog.logger', ['channel' =>'messenger'])

->set('messenger.listener.stop_worker_on_sigterm_signal_listener',StopWorkerOnSigtermSignalListener::class)
Copy link
Member

Choose a reason for hiding this comment

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

is it a BC break? 🤔

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

isn't that internal service used by framework itself? how can it be BC-break?

@@ -1,5 +1,6 @@
framework:
messenger:
stop_signals:SIGTERM
Copy link
Member

Choose a reason for hiding this comment

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

Agreed with@Warxcell. we should allow multiple signals.

@magnetik
Copy link
Contributor

@Warxcell hi, sorry for the direct ping :)
Are you willing to continue this PR or can someone take this over?

@Warxcell
Copy link
ContributorAuthor

Yes, sorry. Will try to finish till the end of the week.

magnetik reacted with thumbs up emoji

@WarxcellWarxcellforce-pushed theconfigurable_stop_signal branch 2 times, most recently from33341f9 to8aaa16dCompareMarch 15, 2022 07:28
@WarxcellWarxcell changed the base branch from6.0 to6.1March 15, 2022 07:30
@WarxcellWarxcellforce-pushed theconfigurable_stop_signal branch 2 times, most recently from58cd5d6 todac1bd8CompareMarch 15, 2022 07:39
@WarxcellWarxcellforce-pushed theconfigurable_stop_signal branch fromdac1bd8 to2aef839CompareMarch 15, 2022 08:43
@Warxcell
Copy link
ContributorAuthor

Need a little help - one test needs PCNTL extension, and the other don't need it - is this achievable?

@fabpotfabpot modified the milestones:6.1,6.2May 20, 2022
@nicolas-grekasnicolas-grekas modified the milestones:6.2,6.3Nov 5, 2022
@nicolas-grekasnicolas-grekas modified the milestones:6.3,6.4May 23, 2023
@nicolas-grekasnicolas-grekas modified the milestones:6.4,7.1Nov 15, 2023
@nicolas-grekasnicolas-grekas added this to the6.4 milestoneNov 15, 2023
@fabpot
Copy link
Member

Closing in favor of#54510

@fabpotfabpot closed thisApr 8, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@jderussejderussejderusse left review comments

+1 more reviewer

@ruudkruudkruudk left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

6.4

Development

Successfully merging this pull request may close these issues.

[Messenger] Gracefull stop messenger when ran in Docker FPM Image

7 participants

@Warxcell@carsonbot@magnetik@fabpot@ruudk@jderusse@nicolas-grekas

[8]ページ先頭

©2009-2025 Movatter.jp