Skip to content

CPS handler could call the continuation function multiple times #1

@alihammad-gist

Description

@alihammad-gist

"A CPS handler could call the continuation function multiple times. I'm not sure how to prevent this, (or if I should) so don't do it..."

Just wanted to reply to this, you could encapsulate continuation inside an object with a queue of remaining continuations, when the "proxy" continuation is called it de-queues the next continuation in the queue and runs it passing it the request and the proxy continuation. Call to any continuation won't return until all the subsequent continuations are evaluated hence draining the queue, second calls to any continuation would raise some sort of error. Here is a very succinct implementation.
https://github.com/zendframework/zend-stratigility/blob/master/src/Next.php#L50

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions