relaton 1.9.5 → 1.9.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/README.adoc +1 -0
- data/lib/relaton/db.rb +2 -1
- data/lib/relaton/version.rb +1 -1
- data/lib/relaton/workers_pool.rb +3 -3
- data/spec/relaton/db_spec.rb +10 -0
- data/spec/vcr_cassetes/async_fetch.yml +1370 -1370
- data/spec/vcr_cassetes/bsi_bs_en_iso_8848.yml +10 -10
- data/spec/vcr_cassetes/cc_dir_10005_2019.yml +14 -14
- data/spec/vcr_cassetes/cen_en_10160_1999.yml +29 -29
- data/spec/vcr_cassetes/cie_001_1980.yml +7 -7
- data/spec/vcr_cassetes/ecma_6.yml +7 -7
- data/spec/vcr_cassetes/fisp_140.yml +6 -6
- data/spec/vcr_cassetes/gb_t_20223_2006.yml +8 -8
- data/spec/vcr_cassetes/iana_service_names_port_numbers.yml +10 -10
- data/spec/vcr_cassetes/iec_60050_102_2007.yml +27 -27
- data/spec/vcr_cassetes/iec_combined_included.yml +94 -92
- data/spec/vcr_cassetes/ieee_528_2019.yml +14 -14
- data/spec/vcr_cassetes/iho_b_11.yml +7 -7
- data/spec/vcr_cassetes/iso_111111119115_1.yml +2 -2
- data/spec/vcr_cassetes/iso_19115_1.yml +15 -15
- data/spec/vcr_cassetes/iso_19115_1_2.yml +32 -32
- data/spec/vcr_cassetes/iso_19115_all_parts.yml +15 -15
- data/spec/vcr_cassetes/iso_19133_2005.yml +15 -15
- data/spec/vcr_cassetes/iso_cd_14093.yml +13 -13
- data/spec/vcr_cassetes/iso_combined_applied.yml +31 -31
- data/spec/vcr_cassetes/iso_combined_included.yml +29 -29
- data/spec/vcr_cassetes/itu_combined_included.yml +168 -168
- data/spec/vcr_cassetes/ogc_19_025r1.yml +7 -7
- data/spec/vcr_cassetes/omg_ami4ccm_1_0.yml +4 -4
- data/spec/vcr_cassetes/rfc_8341.yml +7 -7
- data/spec/vcr_cassetes/sp_800_38b.yml +6 -6
- data/spec/vcr_cassetes/threads_from_env.yml +448 -0
- data/spec/vcr_cassetes/un_rtade_cefact_2004_32.yml +30 -30
- data/spec/vcr_cassetes/w3c_json_ld11.yml +9 -9
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0856681e37a3dfb7fef7e84084c49990f4f980efcdf2bd3be6e019c9baf8c3e6'
|
4
|
+
data.tar.gz: 9c53c38d1b422435f5969ce02f7bee7b05d1195e57b0526a958a83abcaf2eea6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc981fcd5df1fc7de922df2a2e979963d26ef784e4a6bc88448a632a8b09a0483292edbd2ecbe70caa129d59a7c9254c95c9307d01bd5dba6d0e28cd17832fbb
|
7
|
+
data.tar.gz: 27cb0dd8f208880222fdc4d8960ef644ca9ec1b1ed678621807ca319fe0596e7a560815c78504b4ebd4de35198f91a054125e5632273a068d44781abfa62a65e
|
data/docs/README.adoc
CHANGED
data/lib/relaton/db.rb
CHANGED
@@ -105,7 +105,8 @@ module Relaton
|
|
105
105
|
if stdclass
|
106
106
|
unless @queues[stdclass]
|
107
107
|
processor = @registry.processors[stdclass]
|
108
|
-
|
108
|
+
threads = ENV["RELATON_FETCH_PARALLEL"]&.to_i || processor.threads
|
109
|
+
wp = WorkersPool.new(threads) do |args|
|
109
110
|
args[3].call fetch(*args[0..2])
|
110
111
|
rescue RelatonBib::RequestError => e
|
111
112
|
args[3].call e
|
data/lib/relaton/version.rb
CHANGED
data/lib/relaton/workers_pool.rb
CHANGED
@@ -4,9 +4,9 @@ module Relaton
|
|
4
4
|
# Workers poll.
|
5
5
|
class WorkersPool
|
6
6
|
def initialize(workers = 2, &_block)
|
7
|
-
num_workers = workers < 2 ? 2 : workers
|
8
|
-
@queue = SizedQueue.new(
|
9
|
-
@threads = Array.new
|
7
|
+
# num_workers = workers < 2 ? 2 : workers
|
8
|
+
@queue = SizedQueue.new(workers * 2)
|
9
|
+
@threads = Array.new workers do
|
10
10
|
Thread.new do
|
11
11
|
while item = @queue.pop; yield(item) end
|
12
12
|
end
|
data/spec/relaton/db_spec.rb
CHANGED
@@ -184,6 +184,16 @@ RSpec.describe Relaton::Db do
|
|
184
184
|
end
|
185
185
|
expect(result).to be_nil
|
186
186
|
end
|
187
|
+
|
188
|
+
it "use threads number from RELATON_FETCH_PARALLEL" do
|
189
|
+
expect(ENV).to receive(:[]).with("RELATON_FETCH_PARALLEL").and_return(1)
|
190
|
+
allow(ENV).to receive(:[]).and_call_original
|
191
|
+
expect(Relaton::WorkersPool).to receive(:new).with(1).and_call_original
|
192
|
+
VCR.use_cassette "threads_from_env" do
|
193
|
+
db.fetch_async("ITU-T G.993.5") { |r| queue << r }
|
194
|
+
Timeout.timeout(5) { queue.pop }
|
195
|
+
end
|
196
|
+
end
|
187
197
|
end
|
188
198
|
|
189
199
|
context "fetch documents form static cache" do
|