Skip to content

Commit

Permalink
fix: Move Monitor dump to after_response (#26703) (#26709)
Browse files Browse the repository at this point in the history
It needs access to response to capture status code and size etc

(cherry picked from commit 04642ed)

Co-authored-by: Ankush Menat <ankush@frappe.io>
  • Loading branch information
mergify[bot] and ankush committed Jun 7, 2024
1 parent 68b2c4b commit c24ee13
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 0 additions & 1 deletion frappe/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ def application(environ, start_response):
app(environ, start_response),
(
frappe.rate_limiter.update,
frappe.monitor.stop,
frappe.recorder.dump,
frappe.request.after_response.run,
frappe.destroy,
Expand Down
4 changes: 4 additions & 0 deletions frappe/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,10 @@
"frappe.rate_limiter.apply",
]

after_request = [
"frappe.monitor.stop",
]

# Background Job Hooks
before_job = [
"frappe.recorder.record",
Expand Down
2 changes: 1 addition & 1 deletion frappe/tests/test_perf.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ class TestOverheadCalls(FrappeAPITestCase):

def test_ping_overheads(self):
self.get(self.method("ping"), {"sid": "Guest"})
with self.assertRedisCallCounts(12), self.assertQueryCount(self.BASE_SQL_CALLS):
with self.assertRedisCallCounts(13), self.assertQueryCount(self.BASE_SQL_CALLS):
self.get(self.method("ping"), {"sid": "Guest"})

def test_list_view_overheads(self):
Expand Down

0 comments on commit c24ee13

Please sign in to comment.