10000 Enforce timer interval as minimum time to execution by kelunik · Pull Request #319 · amphp/amp · GitHub
[go: up one dir, main page]

Skip to content

Enforce timer interval as minimum time to execution #319

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

Merged
merged 9 commits into from
Jul 14, 2020
Merged

Conversation

kelunik
Copy link
Member
@kelunik kelunik commented May 25, 2020

Relates to symfony/symfony#36960.

$this->assertNotSame(0, $invoked);

$this->assertGreaterThan(1000, $invoked - $start);
$this->assertLessThan(1100, $invoked - $start);
Copy link
Member Author

Choose a reason for hiding this comment

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

This is currently expected to fail, because watchers are only activated in the next tick.

Watchers are only activated on next tick.
@nicolas-grekas
Copy link

I'm running into this issue on symfony/symfony#37136.
Here is my local reproducer:
./phpunit src/Symfony/Component/HttpClient/ --filter 'Amp.*(Vulcain|Pause)'
Any idea about what could be causing this? Any workaround maybe?

@nicolas-grekas
Copy link
nicolas-grekas commented Jun 8, 2020

I had a closer look and this relates to the $nowUpdateNeeded property: forcing it to true by wrapping the Loop::delay() inside Loop::defer() works around the issue. The reason is that a tick() happens before the call.

The fix could be to set $nowUpdateNeeded to true when Loop::delay() is called.

trowski and others added 5 commits July 13, 2020 10:12
Like everything shutdown related, this depends on destruction order and appears to only happen on 7.4+.
* origin/test-failures:
  Fix expected output
  Add failing tests

# Conf
8000
licts:
#	test/Loop/DriverTest.php
@kelunik kelunik requested a review from trowski July 14, 2020 18:51
@kelunik kelunik changed the title Add failing tests Fix timer interval being a minimum time to execution Jul 14, 2020
trowski
trowski previously approved these changes Jul 14, 2020
@kelunik kelunik changed the title Fix timer interval being a minimum time to execution Enforce timer interval as minimum time to execution Jul 14, 2020
@kelunik kelunik merged commit 05483cd into master Jul 14, 2020
@kelunik kelunik deleted the test-failures branch July 14, 2020 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0