Kouhei Sutou
null+****@clear*****
Wed Jan 18 13:40:58 JST 2017
Kouhei Sutou 2017-01-18 13:40:58 +0900 (Wed, 18 Jan 2017) New Revision: 103e9de3c1a6975c0683d25d8b7017b6d1796757 https://github.com/groonga/grntest/commit/103e9de3c1a6975c0683d25d8b7017b6d1796757 Message: Split load to chunks Modified files: lib/grntest/executors/base-executor.rb Modified: lib/grntest/executors/base-executor.rb (+16 -14) =================================================================== --- lib/grntest/executors/base-executor.rb 2016-11-04 14:01:49 +0900 (ae13cac) +++ lib/grntest/executors/base-executor.rb 2017-01-18 13:40:58 +0900 (498b218) @@ -1,4 +1,4 @@ -# Copyright (C) 2012-2014 Kouhei Sutou <kou �� clear-code.com> +# Copyright (C) 2012-2017 Kouhei Sutou <kou �� clear-code.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -295,21 +295,23 @@ module Grntest def execute_directive_generate_series(parser, line, content, options) start, stop, table, template, = options evaluator = TemplateEvaluator.new(template) - parser << "load --table #{table}\n" - parser << "[" - first_record = true - Integer(start).step(Integer(stop)) do |i| - record = "" - if first_record - first_record = false - else - record << "," + (Integer(start)..Integer(stop)).each_slice(1000) do |range| + parser << "load --table #{table}\n" + parser << "[" + first_record = true + range.each do |i| + record = "" + if first_record + first_record = false + else + record << "," + end + record << "\n" + record << evaluator.evaluate(i).to_json + parser << record end - record << "\n" - record << evaluator.evaluate(i).to_json - parser << record + parser << "\n]\n" end - parser << "\n]\n" end def execute_directive(parser, line, content) -------------- next part -------------- HTML����������������������������...Download