From 0bab6310d623f9f8ed382c93ddeb9f4d1a0b8f75 Mon Sep 17 00:00:00 2001
From: John Hawthorn <john@hawthorn.email>
Date: Sun, 14 Apr 2019 18:22:43 -0700
Subject: Find query_source_location using lazy Enumerator

This way, we only need to filter the backtrace up to the first non-noise
stack frame.

This also updates noise to be able to deal with being passed a lazy
enum. We don't need this anywhere, but it seemed better for this to be
consistent.
---
 activerecord/lib/active_record/log_subscriber.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'activerecord')

diff --git a/activerecord/lib/active_record/log_subscriber.rb b/activerecord/lib/active_record/log_subscriber.rb
index 6b84431343..6248c2f578 100644
--- a/activerecord/lib/active_record/log_subscriber.rb
+++ b/activerecord/lib/active_record/log_subscriber.rb
@@ -110,7 +110,7 @@ module ActiveRecord
       end
 
       def extract_query_source_location(locations)
-        backtrace_cleaner.clean(locations).first
+        backtrace_cleaner.clean(locations.lazy).first
       end
   end
 end
-- 
cgit v1.2.3