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

[Stopwatch] Fixed bug in getDuration when counting multiple ongoing periods #34181

Merged
merged 1 commit into from Nov 3, 2019
Merged

[Stopwatch] Fixed bug in getDuration when counting multiple ongoing periods #34181

merged 1 commit into from Nov 3, 2019

Conversation

TimoBakx
Copy link
Member

Q A
Branch? 3.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #34087
License MIT
Doc PR N/A

When running multiple periods in StopwatchEvent (start multiple times and not stop them all), the getDuration() method would return unexpected values.

This was because at every stop, the last entry in the started array was removed, while the getDuration method was still expecting all the started events to still be there.

Now, when calling getDuration, the duration of all the finished periods are added together with the unfinished counts.

@nicolas-grekas nicolas-grekas added this to the 3.4 milestone Oct 30, 2019
@nicolas-grekas nicolas-grekas changed the title [Stopwatch] Fixed bug in getDuration when counting multiple ongoing p… [Stopwatch] Fixed bug in getDuration when counting multiple ongoing periods Oct 30, 2019
@fabpot
Copy link
Member

fabpot commented Nov 3, 2019

Thank you @TimoBakx.

fabpot added a commit that referenced this pull request Nov 3, 2019
…e ongoing periods (TimoBakx)

This PR was merged into the 3.4 branch.

Discussion
----------

[Stopwatch] Fixed bug in getDuration when counting multiple ongoing periods

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #34087
| License       | MIT
| Doc PR        | N/A

When running multiple periods in StopwatchEvent (start multiple times and not stop them all), the getDuration() method would return unexpected values.

This was because at every stop, the last entry in the `started` array was removed, while the `getDuration` method was still expecting all the started events to still be there.

Now, when calling `getDuration`, the duration of all the finished periods are added together with the unfinished counts.

Commits
-------

af00d8d [Stopwatch] Fixed bug in getDuration when counting multiple ongoing periods
@fabpot fabpot merged commit af00d8d into symfony:3.4 Nov 3, 2019
This was referenced Nov 11, 2019
@TimoBakx TimoBakx deleted the stopwatch-event-duration branch February 9, 2020 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants