Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generator function only display once in call stack when user call it circularly. #100

Closed
EyelynSu opened this issue Aug 14, 2019 · 2 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers v0.2.x For 0.2.x version( via composer)

Comments

@EyelynSu
Copy link
Collaborator

EyelynSu commented Aug 14, 2019

[env]
pinpoint-c-agent: dev-2

[step]

  1. Monitor a generator function:
class TestGenerator
{
    function generator($start, $limit, $step=1){
        if($start > $limit){
            throw new LogicException("start cannot bigger that limit.");
        }
        usleep(120000);
        for($i = $start; $i<=$limit; $i += $step){
            try{
                yield $i;
            }catch (Exception $exception){
                echo $exception->getMessage();
            }
        }
    }
}
$instance = new TestGenerator();
foreach ($instance->generator(1, 10, 2) as $number){echo $number;}

[result]
Generator function only display once in call stack.
1565769771

@EyelynSu EyelynSu added the bug Something isn't working label Aug 14, 2019
@eeliu eeliu added the v0.2.x For 0.2.x version( via composer) label Aug 14, 2019
@eeliu
Copy link
Collaborator

eeliu commented Aug 15, 2019

@EyelynSu
The aop not support return a wrapped gernerator.
We could add a plugin example to wrapped the return.
Thanks

@eeliu eeliu added the Known problem We knew this problem and was trying to find solution. label Feb 14, 2020
@eeliu eeliu closed this as completed Apr 29, 2020
@eeliu eeliu added enhancement New feature or request good first issue Good for newcomers and removed Known problem We knew this problem and was trying to find solution. bug Something isn't working labels Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers v0.2.x For 0.2.x version( via composer)
Projects
None yet
Development

No branches or pull requests

2 participants