[Groonga-commit] groonga/groonga [master] [query-log][analyzer] work on Ruby 1.8.7.

Back to archive index

null+****@clear***** null+****@clear*****
2011年 6月 10日 (金) 15:01:44 JST


Kouhei Sutou	2011-06-10 06:01:44 +0000 (Fri, 10 Jun 2011)

  New Revision: a936f8821017f32389ed1b2101a0477a9ea1d76b

  Log:
    [query-log][analyzer] work on Ruby 1.8.7.

  Modified files:
    tools/groonga-query-log-analyzer.rb

  Modified: tools/groonga-query-log-analyzer.rb (+12 -9)
===================================================================
--- tools/groonga-query-log-analyzer.rb    2011-06-10 05:54:21 +0000 (ac6ee43)
+++ tools/groonga-query-log-analyzer.rb    2011-06-10 06:01:44 +0000 (cd2c140)
@@ -437,12 +437,13 @@ class GroongaQueryLogAnaylzer
       buffer_size = @max_size * 100
       if size < buffer_size
         super(grouped_operation)
-        sort_by!(&@sorter)
+        replace(sort_by(&@sorter))
       else
         if****@sorte*****(grouped_operation) < @sorter.call(last)
           super(grouped_operation)
-          sort_by!(&@sorter)
-          pop
+          sorted_operations = sort_by(&@sorter)
+          sorted_operations.pop
+          replace(sorted_other)
         end
       end
       self
@@ -498,21 +499,23 @@ class GroongaQueryLogAnaylzer
       update_statistic(statistic)
       if size < @max_size
         super(statistic)
-        sort_by!(&@sorter)
+        replace(self)
       else
         if****@sorte*****(statistic) < @sorter.call(last)
           super(statistic)
-          sort_by!(&@sorter)
-          pop
+          replace(self)
         end
       end
       self
     end
 
     def replace(other)
-      super(other)
-      sort_by!(&@sorter)
-      super(self[0, @max_size])
+      sorted_other = other.sort_by(&@sorter)
+      if sorted_other.size > @max_size
+        super(sorted_other[0, @max_size])
+      else
+        super(sorted_other)
+      end
     end
 
     def responses_per_second




Groonga-commit メーリングリストの案内
Back to archive index