Skip to content

Commit

Permalink
Fixed a bug where model termination would not work immediately if ter…
Browse files Browse the repository at this point in the history
…minate() was called in constructor
  • Loading branch information
Miika Arponen committed Nov 4, 2021
1 parent aab07ec commit 199f981
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http:https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http:https://semver.org/spec/v2.0.0.html).

# Unreleased

## [terminated-hotfix] - 2021-11-04

### Fixed
- A bug where model termination would not work immediately if `terminate()` was called in constructor.

# Released

## [1.34.4] - 2021-10-14
Expand Down
8 changes: 4 additions & 4 deletions classes/model.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,10 @@ public function fetch_data( $functions = null, $tidy = false ) {
// Loop through all public methods and run the ones we wanted to deliver the data to the views.
foreach ( $methods as $class => $class_methods ) {
foreach ( $class_methods as $name => $m ) {
if ( $this->terminated ) {
break 2;
}

if ( $perf_monitoring_enabled ) {
$perf_key = $this->perf_key( $m );
dustpress()->start_performance( $perf_key );
Expand Down Expand Up @@ -374,10 +378,6 @@ public function fetch_data( $functions = null, $tidy = false ) {
if ( $perf_monitoring_enabled ) {
dustpress()->save_performance( $perf_key );
}

if ( $this->terminated ) {
break 2;
}
}

unset( $class_methods );
Expand Down

0 comments on commit 199f981

Please sign in to comment.