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

[Console][QuestionHelper] add optional timeout for human interaction#61092

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

Open
janedbal wants to merge10 commits intosymfony:7.4
base:7.4
Choose a base branch
Loading
fromjanedbal:question-timeout

Conversation

janedbal
Copy link
Contributor

@janedbaljanedbal commentedJul 10, 2025
edited
Loading

QA
Branch?7.4
Bug fix?no
New feature?yes
Deprecations?no
IssuesNone
LicenseMIT

About:

  • Adds timeout functionality to console questions, allowing developers to set a maximum time limit for user input.
  • Our usecase is that some developers added interactive questions inside opened db transactions. Without timeout, it can lead to hours long trx if somebody forgets to repond and keeps the terminal open.
  • The feature is backward compatible - existing code continues to work without timeouts unless explicitly set.

@carsonbotcarsonbot added this to the7.4 milestoneJul 10, 2025
@carsonbotcarsonbot changed the titleQuestionHelper: add optional timeout for human interaction[Console] QuestionHelper: add optional timeout for human interactionJul 10, 2025
@OskarStarkOskarStark changed the title[Console] QuestionHelper: add optional timeout for human interaction[Console][QuestionHelper] add optional timeout for human interactionJul 10, 2025
Co-authored-by: Oskar Stark <oskarstark@googlemail.com>
janedbaland others added2 commitsJuly 14, 2025 15:27
Co-authored-by: Anderson Müller <anderson.a.muller@gmail.com>
@janedbal
Copy link
ContributorAuthor

Any chance this get approved/merged soon? I believe those CI failures are not relevant. Thanks

Comment on lines +513 to +514
$plural = 1 === $timeoutSeconds ? '' : 's';
throw new MissingInputException("Timed out after waiting for input for $timeoutSeconds second$plural.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
$plural =1 ===$timeoutSeconds ?'' :'s';
thrownewMissingInputException("Timed out after waiting for input for$timeoutSeconds second$plural.");
thrownewMissingInputException(\sprintf('Timed out after waiting for input for %d %s.',$timeoutSeconds,$timeoutSeconds ===1 ?'second' :'seconds'));

?


/**
* The timeout is the maximum time the user has to answer the question.
* If the user does not answer within this time, an exception will be thrown.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* If the user does not answer within this time, an exception will be thrown.

this logic is part of the questionHelper, not the setter.

@@ -38,6 +38,7 @@ class Question
private ?\Closure $normalizer = null;
private bool $trimmable = true;
private bool $multiline = false;
private ?int $timeoutSeconds = null;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
private ?int$timeoutSeconds =null;
private ?int$timeout =null;

same for set and get methods?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@stofstofstof left review comments

@OskarStarkOskarStarkOskarStark left review comments

@andersonamullerandersonamullerandersonamuller left review comments

@chalasrchalasrAwaiting requested review from chalasrchalasr is a code owner

Assignees
No one assigned
Projects
None yet
Milestone
7.4
Development

Successfully merging this pull request may close these issues.

5 participants
@janedbal@stof@OskarStark@andersonamuller@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp