move wait_for_empty_queue_with_timeout method inside client class (#60)

approved
#1

move wait_for_empty_queue_with_timeout method inside client class (#60)

diff --git a/lib/prometheus_exporter/client.rb b/lib/prometheus_exporter/client.rb
index 21b6835..049aa2e 100644
--- a/lib/prometheus_exporter/client.rb
+++ b/lib/prometheus_exporter/client.rb
@@ -197,6 +197,13 @@ module PrometheusExporter
       raise
     end
 
+    def wait_for_empty_queue_with_timeout(timeout_seconds)
+      start_time = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
+      while @queue.length > 0
+        break if start_time + timeout_seconds < ::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
+        sleep(0.05)
+      end
+    end
   end
 
   class LocalClient < Client
@@ -211,12 +218,4 @@ module PrometheusExporter
       @collector.process(json)
     end
   end
-
-  def wait_for_empty_queue_with_timeout(timeout_seconds)
-    start_time = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
-    while @queue.length > 0
-      break if start_time + timeout_seconds < ::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
-      sleep(0.05)
-    end
-  end
 end

GitHub sha: 93fb8062

1 Like
Approved #2