twitter_with_auto_pagination 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d90e01f64833555787086bd404712bded755f819c92adfe0c8669e893b38d23
4
- data.tar.gz: 2f5962f83bfd634933b06ff098a20a715014d2590c34ef4c421a60888f93f16a
3
+ metadata.gz: 69da079c4add77431e42fe20bc51b636acbf06bf2ca309043f5a7fcba36a15b7
4
+ data.tar.gz: 76664f7078549527d17086d4f13811aa494184521a9e755f0e4a5f07081aa4b7
5
5
  SHA512:
6
- metadata.gz: bebf5af92ed04b5abed1766cd46057800d67832079e15afa1e312684a7ba88df46547f42526a4bc4f723e654a56b3bf18d1a8a461cc07fd8dfabec8ee51ec51a
7
- data.tar.gz: 9699e975305d37e1fb114b0c83b009e31cc9d9680cd9c562ee017f5bea98ed384e5d8da2931e7dc18cfb2a357a5e22c1f972e0067ed4cf48b6bb946bdebdcdfa
6
+ metadata.gz: 4d503d8c44b124959a829a1a223d2d3a2ac450c70e1ca97b352f0d5d1c1fec02092f4932a3e3674fc829c4a60063bc0fdaa99851b1b28b1895e70dece1afd663
7
+ data.tar.gz: 52d22fd58cceb35ac6f93c6ec8ef39b98c24230701f681c0721d76875edd71df7939510995152e2835cc7e0bf06d5905494ec669148709cc328062bc3c4e7982
@@ -39,10 +39,15 @@ module TwitterWithAutoPagination
39
39
 
40
40
  def users_internal(values, options = {})
41
41
  options = options.merge(super_operation: :users)
42
-
43
- parallel(in_threads: 10) do |batch|
44
- values.each_slice(MAX_USERS_PER_REQUEST) { |targets| batch.users(targets, options) }
45
- end.flatten
42
+ threads = options.delete(:threads) || 5
43
+
44
+ if threads > 1
45
+ parallel(in_threads: threads) do |batch|
46
+ values.each_slice(MAX_USERS_PER_REQUEST) { |targets| batch.users(targets, options) }
47
+ end.flatten
48
+ else
49
+ values.each_slice(MAX_USERS_PER_REQUEST).map { |targets| users(targets, options) }.flatten
50
+ end
46
51
  end
47
52
  end
48
53
  end
@@ -21,5 +21,5 @@ Gem::Specification.new do |spec|
21
21
  spec.required_ruby_version = '>= 2.3'
22
22
  spec.summary = spec.description
23
23
  spec.test_files = Dir.glob('spec/**/*')
24
- spec.version = '0.13.0'
24
+ spec.version = '0.14.0'
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitter_with_auto_pagination
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shinohara Teruki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-06 00:00:00.000000000 Z
11
+ date: 2020-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: twitter