statamic / v2-hub

Statamic 2 - Feature Requests and Bug Reports
https://statamic.com
95 stars 5 forks source link

🐛🦌Antler engine measurements don't finish #2473

Closed rrelmy closed 4 years ago

rrelmy commented 4 years ago

Describe the bug The measurements done by the Antlers engine are not stopped in the happy path where content is returned. Only when an exception happens

To Reproduce Steps to reproduce the behavior:

  1. Enable the DebugBar
  2. Check the debugbar, most of the Tag: * bars go until the end
  3. Apply the patch 🤷‍♂
  4. Check the debugbar again

Expected behavior Measurements should be correct I suppose …

Screenshots Instead of a screenshot here is a patch

Index: statamic/core/View/Antlers/Engine.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- statamic/core/View/Antlers/Engine.php   (revision cd5662d3f31558bbc832d7f790b8cd3168a53188)
+++ statamic/core/View/Antlers/Engine.php   (date 1576533918048)
@@ -173,8 +173,8 @@
             throw $e;
         } catch (\Exception $e) {
             throw $e;
-        }
-
-        stop_measure($tag_measure);
+        } finally {
+            stop_measure($tag_measure);
+        }
     }
 }

Environment details (please complete the following information):

jackmcdade commented 4 years ago

Nice one, thanks!