TimingsHandler: don't bail on redundant attempts to stop non-running timers

while it would be nice to bail, providing the environment to allow bailing without breaking stuff requires some complex changes that would reduce performance when timings is not running. Considering the limited usefulness of bailing here anyway, and the fact that it just has to be prevented to not have side effects, it doesn't make a whole lot of sense right now.

closes #3261, closes #3269, closes #3254
This commit is contained in:
Dylan K. Taylor 2020-01-04 14:44:52 +00:00
parent cef77907c6
commit 9232f4509c

View File

@ -180,7 +180,10 @@ class TimingsHandler{
private function internalStopTiming(float $now) : void{
if($this->timingDepth === 0){
throw new \InvalidStateException("Cannot stop a timer that is not running");
//TODO: it would be nice to bail here, but since we'd have to track timing depth across resets
//and enable/disable, it would have a performance impact. Therefore, considering the limited
//usefulness of bailing here anyway, we don't currently bother.
return;
}
if(--$this->timingDepth !== 0 or $this->start == 0){
return;