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

[Messenger] ease testing and allow forking the middleware stack#31204

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

Merged

Conversation

@nicolas-grekas
Copy link
Member

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#31179
LicenseMIT
Doc PR-

A less radical alternative than#31185 that preserves laziness and addresses the linked issue.

Copy link
Member

@weaverryanweaverryan left a comment

Choose a reason for hiding this comment

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

I played with this - works really nicely to solve the problem of a middleware callinghandle() multiple times. The middleware needs to know they should clone the stack, but I think that's not a huge issue.

return$this->iterator =null;
}

return$this->stack[] =$this->iterator->current();
Copy link
Member

@weaverryanweaverryanApr 23, 2019
edited
Loading

Choose a reason for hiding this comment

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

I had to stare at this for a minute. When you clone theStackMiddleware, each clone will still maintain this same, one instance of thisMiddlewareStack, but will now maintain their ownStackMiddleware.offset property (so, that property will move independently). The firstStackMiddleware that uses an item from the iterator will use it, but store it on the stack so that it's available when the otherStackMiddleware asks for that same$offset.

nicolas-grekas, xabbuh, and sroze reacted with thumbs up emoji
/**
* @internal
*/
class MiddlewareStack
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't you simply drop the iterator, store middleware as array inStackMiddleware and advance the pointer manually?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

That would defeat laziness, which is a desired property.

@nicolas-grekasnicolas-grekas merged commit3bdf4b0 intosymfony:masterApr 26, 2019
nicolas-grekas added a commit that referenced this pull requestApr 26, 2019
…are stack (nicolas-grekas)This PR was merged into the 4.3-dev branch.Discussion----------[Messenger] ease testing and allow forking the middleware stack| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#31179| License       | MIT| Doc PR        | -A less radical alternative than#31185 that preserves laziness and addresses the linked issue.Commits-------3bdf4b0 [Messenger] ease testing and allow forking the middleware stack
@nicolas-grekasnicolas-grekas modified the milestones:next,4.3Apr 30, 2019
@fabpotfabpot mentioned this pull requestMay 9, 2019
@nicolas-grekasnicolas-grekas deleted the messenger-stack branchMay 21, 2019 08:22
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@weaverryanweaverryanweaverryan approved these changes

@chalasrchalasrchalasr approved these changes

+1 more reviewer

@danizorddanizorddanizord left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.3

Development

Successfully merging this pull request may close these issues.

5 participants

@nicolas-grekas@weaverryan@danizord@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp