legion-transport 1.1.6 → 1.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 567b542ea43b5a232f8abdde592f899666b9dff1e976fe6c14790394ab056bd2
4
- data.tar.gz: 103aab3379485b1731119820f26b8b38b25fd8592efe9b1e6c7fa10aa9f629e9
3
+ metadata.gz: 63d52e031c058a898022ffe052a75fdee6bd83208f37e5413e5e1b361883d3bd
4
+ data.tar.gz: 5be4a5d602de235d0ff73fab3f31c93f8ac664eee869f4e0bd6f36e3471dc49e
5
5
  SHA512:
6
- metadata.gz: 66958af49eba04baee630061c0359078cbf02955392b830e921587044425e7b3333d511198006d7324a49e4364a56ad98b2234a4b55b6724029b5c7f805c0676
7
- data.tar.gz: ddeddc83b4a865af2a9ee817732f7102b8bde0ef5b8b729b8959dea1176ab9da945ce42b799a55e6bc5f83101f38a11756a0e519355b9fd296f1de6f353de4fa
6
+ metadata.gz: f65bf581a683147c76a1b64d410b1603397f1f66365209b2bae6d89607e967cac7aaf641b9a88dfb9e434ef5ac4871da9737ff2bf0814a52331730c0ff3f1145
7
+ data.tar.gz: ada8ca704e24de54ff6096b094b1352117495b7c1f9a3ce67bdbb107629dbd4b77282193b55b0f7f7617b6214f4943e44ad30d95b8d4feb1333bc23b2bba3d32
@@ -14,6 +14,7 @@ jobs:
14
14
  - run:
15
15
  name: Run Rubocop
16
16
  command: bundle exec rubocop
17
+ - sonarcloud/scan
17
18
  - ruby/save-cache
18
19
  "ruby-two-five":
19
20
  docker:
@@ -27,6 +28,7 @@ jobs:
27
28
  command: gem update bundler
28
29
  - ruby/install-deps
29
30
  - ruby/run-tests
31
+ - sonarcloud/scan
30
32
  - ruby/save-cache
31
33
  "ruby-two-six":
32
34
  docker:
@@ -40,6 +42,7 @@ jobs:
40
42
  command: gem update bundler
41
43
  - ruby/install-deps
42
44
  - ruby/run-tests
45
+ - sonarcloud/scan
43
46
  - ruby/save-cache
44
47
  "ruby-two-seven":
45
48
  docker:
@@ -53,19 +56,6 @@ jobs:
53
56
  command: gem update bundler
54
57
  - ruby/install-deps
55
58
  - ruby/run-tests
56
- - ruby/save-cache
57
- "sonarcloud":
58
- docker:
59
- - image: circleci/ruby:2.7
60
- - image: rabbitmq:3.7
61
- steps:
62
- - checkout
63
- - ruby/load-cache
64
- - ruby/install-deps
65
- - ruby/run-tests
66
- - run:
67
- name: Run Rubocop
68
- command: bundle exec rubocop --format=json --out=rubocop-result.json
69
59
  - sonarcloud/scan
70
60
  - ruby/save-cache
71
61
 
@@ -82,8 +72,4 @@ workflows:
82
72
  - ruby-two-five
83
73
  - ruby-two-seven:
84
74
  requires:
85
- - ruby-two-five
86
- - sonarcloud:
87
- requires:
88
- - ruby-two-seven
89
- - ruby-two-six
75
+ - ruby-two-five
@@ -6,6 +6,8 @@ Metrics/ClassLength:
6
6
  Max: 1500
7
7
  Metrics/BlockLength:
8
8
  Max: 50
9
+ Exclude:
10
+ - 'spec/*/**.rb'
9
11
  Metrics/PerceivedComplexity:
10
12
  Max: 15
11
13
  Metrics/CyclomaticComplexity:
@@ -19,6 +21,7 @@ Style/Documentation:
19
21
  AllCops:
20
22
  TargetRubyVersion: 2.5
21
23
  NewCops: enable
24
+ SuggestExtensions: false
22
25
  Style/FrozenStringLiteralComment:
23
26
  Enabled: false
24
27
  Naming/FileName:
@@ -1,5 +1,13 @@
1
1
  # Legion::Transport ChangeLog
2
2
 
3
+ ## v1.1.8
4
+ * Removing codecov gem
5
+ * Changing bunny gem requirement to `>= 2.17.0`
6
+ * Changing current-ruby gem requirement to `>= 1.1.7`
7
+ * Removing JRuby support
8
+ * Removing bin/ folder
9
+ * Cleaning up some channel objects inside Messages and Queues
10
+
3
11
  ## v1.1.3
4
12
  * Adding JRuby support via a different gem
5
13
  * Adding more logic on choosing which gem to pick for the CONNECTOR
@@ -1,25 +1,14 @@
1
- image: ruby:2.7.0
1
+ image: ruby:2.7
2
2
 
3
3
  pipelines:
4
- branches:
5
- master:
6
- - step:
7
- caches:
8
- - bundler
9
- script:
10
- - gem install bundle rubocop
11
- - gem update bundler
12
- - bundle install
13
- - rubocop
14
- - rake
15
- services:
16
- - broker
17
- definitions:
18
- caches:
19
- bundler: vendor/bundle
20
- services:
21
- broker:
22
- image: rabbitmq:3
23
- environment:
24
- RABBITMQ_DEFAULT_USER: guest
25
- RABBITMQ_DEFAULT_PASS: guest
4
+ tags:
5
+ "v*":
6
+ - step:
7
+ name: Push to RubyGems
8
+ deployment: RubyGems
9
+ script:
10
+ - gem install gem-release
11
+ - (umask 077 ; echo $gem_creds | base64 --decode > ~/.gem/credentials)
12
+ - gem release
13
+ artifacts:
14
+ - pkg/**
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
  require 'legion/transport/version'
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.name = (RUBY_ENGINE == 'jruby' ? 'legion-transport-java' : 'legion-transport')
6
+ spec.name = 'legion-transport'
7
7
  spec.version = Legion::Transport::VERSION
8
8
  spec.authors = ['Esity']
9
9
  spec.email = ['matthewdiverson@gmail.com']
@@ -23,21 +23,17 @@ Gem::Specification.new do |spec|
23
23
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
24
24
  f.match(%r{^(test|spec|features)/})
25
25
  end
26
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
26
  spec.require_paths = ['lib']
28
27
 
29
- spec.add_development_dependency 'bundler'
30
- spec.add_development_dependency 'codecov'
31
28
  spec.add_development_dependency 'legion-logging'
32
29
  spec.add_development_dependency 'legion-settings'
33
- spec.add_development_dependency 'march_hare' if RUBY_ENGINE == 'jruby'
34
30
  spec.add_development_dependency 'rake'
35
31
  spec.add_development_dependency 'rspec'
36
32
  spec.add_development_dependency 'rspec_junit_formatter'
37
33
  spec.add_development_dependency 'rubocop'
38
34
  spec.add_development_dependency 'simplecov'
39
35
 
40
- spec.add_dependency 'bunny'
41
- spec.add_dependency 'concurrent-ruby'
36
+ spec.add_dependency 'bunny', '>= 2.17.0'
37
+ spec.add_dependency 'concurrent-ruby', '>= 1.1.7'
42
38
  spec.add_dependency 'legion-json'
43
39
  end
@@ -4,11 +4,21 @@ module Legion
4
4
  module Transport
5
5
  module Connection
6
6
  class << self
7
+ def new
8
+ clone
9
+ end
10
+
7
11
  def connector
8
12
  Legion::Transport::CONNECTOR
9
13
  end
10
14
 
11
- def setup # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
15
+ def reconnect(connection_name: 'Legion', **)
16
+ @session = nil
17
+ @channel_thread = Concurrent::ThreadLocalVar.new(nil)
18
+ setup(connection_name: connection_name)
19
+ end
20
+
21
+ def setup(connection_name: 'Legion', **) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
12
22
  Legion::Logging.info("Using transport connector: #{Legion::Transport::CONNECTOR}")
13
23
 
14
24
  if @session.respond_to?(:value) && session.respond_to?(:closed?) && session.closed?
@@ -16,7 +26,7 @@ module Legion
16
26
  elsif @session.respond_to?(:value) && session.respond_to?(:closed?) && session.open?
17
27
  nil
18
28
  elsif Legion::Transport::TYPE == 'march_hare'
19
- @session ||= Concurrent::Atom.new(
29
+ @session ||= Concurrent::AtomicReference.new(
20
30
  MarchHare.connect(host: Legion::Settings[:transport][:connection][:host],
21
31
  vhost: Legion::Settings[:transport][:connection][:vhost],
22
32
  user: Legion::Settings[:transport][:connection][:user],
@@ -28,9 +38,10 @@ module Legion
28
38
  session.create_channel.basic_qos(1)
29
39
  Legion::Settings[:transport][:connected] = true
30
40
  else
31
- @session ||= Concurrent::Atom.new(
41
+ @session ||= Concurrent::AtomicReference.new(
32
42
  connector.new(
33
43
  Legion::Settings[:transport][:connection],
44
+ connection_name: connection_name,
34
45
  logger: Legion::Logging::Logger.new(level: 'warn'),
35
46
  log_level: :info
36
47
  )
@@ -79,14 +90,19 @@ module Legion
79
90
 
80
91
  def channel_open?
81
92
  channel.open?
93
+ rescue StandardError
94
+ false
82
95
  end
83
96
 
84
97
  def session_open?
85
98
  session.open?
99
+ rescue StandardError
100
+ false
86
101
  end
87
102
 
88
103
  def shutdown
89
104
  session.close
105
+ @session = nil
90
106
  end
91
107
  end
92
108
  end
@@ -107,6 +107,10 @@ module Legion
107
107
  def validate
108
108
  @valid = true
109
109
  end
110
+
111
+ def channel
112
+ Legion::Transport::Connection.channel
113
+ end
110
114
  end
111
115
  end
112
116
  end
@@ -2,8 +2,13 @@ require 'legion/transport/exchanges/task'
2
2
 
3
3
  module Legion
4
4
  module Exception
5
- class InvalidTaskStatus; end
6
- class InvalidTaskId; end
5
+ class InvalidTaskStatus < ArgumentError
6
+ # exception class
7
+ end
8
+
9
+ class InvalidTaskId < ArgumentError
10
+ # exception class
11
+ end
7
12
  end
8
13
  end
9
14
 
@@ -9,13 +9,13 @@ module Legion
9
9
  super(channel, queue, options_builder(default_options, queue_options, options))
10
10
  rescue Legion::Transport::CONNECTOR::PreconditionFailed
11
11
  retries.zero? ? retries = 1 : raise
12
- recreate_queue(channel, queue)
12
+ recreate_queue(queue)
13
13
  retry
14
14
  end
15
15
 
16
- def recreate_queue(channel, queue)
16
+ def recreate_queue(queue)
17
17
  Legion::Logging.warn "Queue:#{queue} exists with wrong parameters, deleting and creating"
18
- queue = ::Bunny::Queue.new(channel, queue, no_declare: true, passive: true)
18
+ queue = ::Bunny::Queue.new(Legion::Transport::Connection.channel, queue, no_declare: true, passive: true)
19
19
  queue.delete(if_empty: true)
20
20
  end
21
21
 
@@ -7,11 +7,12 @@ module Legion
7
7
  def self.connection
8
8
  {
9
9
  read_timeout: 1,
10
- heartbeat: 1,
10
+ heartbeat: 30,
11
11
  automatically_recover: true,
12
12
  continuation_timeout: 4000,
13
13
  network_recovery_interval: 1,
14
14
  connection_timeout: 1,
15
+ frame_max: 65_536,
15
16
  user: 'guest',
16
17
  password: 'guest',
17
18
  host: '127.0.0.1',
@@ -1,5 +1,5 @@
1
1
  module Legion
2
2
  module Transport
3
- VERSION = '1.1.6'.freeze
3
+ VERSION = '1.1.8'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,43 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: legion-transport
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.6
4
+ version: 1.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-28 00:00:00.000000000 Z
11
+ date: 2021-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: codecov
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
13
  - !ruby/object:Gem::Dependency
42
14
  name: legion-logging
43
15
  requirement: !ruby/object:Gem::Requirement
@@ -142,28 +114,28 @@ dependencies:
142
114
  requirements:
143
115
  - - ">="
144
116
  - !ruby/object:Gem::Version
145
- version: '0'
117
+ version: 2.17.0
146
118
  type: :runtime
147
119
  prerelease: false
148
120
  version_requirements: !ruby/object:Gem::Requirement
149
121
  requirements:
150
122
  - - ">="
151
123
  - !ruby/object:Gem::Version
152
- version: '0'
124
+ version: 2.17.0
153
125
  - !ruby/object:Gem::Dependency
154
126
  name: concurrent-ruby
155
127
  requirement: !ruby/object:Gem::Requirement
156
128
  requirements:
157
129
  - - ">="
158
130
  - !ruby/object:Gem::Version
159
- version: '0'
131
+ version: 1.1.7
160
132
  type: :runtime
161
133
  prerelease: false
162
134
  version_requirements: !ruby/object:Gem::Requirement
163
135
  requirements:
164
136
  - - ">="
165
137
  - !ruby/object:Gem::Version
166
- version: '0'
138
+ version: 1.1.7
167
139
  - !ruby/object:Gem::Dependency
168
140
  name: legion-json
169
141
  requirement: !ruby/object:Gem::Requirement
@@ -194,8 +166,6 @@ files:
194
166
  - Gemfile.lock
195
167
  - README.md
196
168
  - Rakefile
197
- - bin/console
198
- - bin/setup
199
169
  - bitbucket-pipelines.yml
200
170
  - legion-transport.gemspec
201
171
  - lib/legion/transport.rb
@@ -234,7 +204,7 @@ metadata:
234
204
  changelog_uri: https://bitbucket.org/legion-io/legion-transport/src/master/CHANGELOG.md
235
205
  homepage_uri: https://bitbucket.org/legion-io/legion-transport
236
206
  wiki_uri: https://bitbucket.org/legion-io/legion-transport/wiki/Home
237
- post_install_message:
207
+ post_install_message:
238
208
  rdoc_options: []
239
209
  require_paths:
240
210
  - lib
@@ -249,8 +219,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
249
219
  - !ruby/object:Gem::Version
250
220
  version: '0'
251
221
  requirements: []
252
- rubygems_version: 3.1.2
253
- signing_key:
222
+ rubygems_version: 3.1.4
223
+ signing_key:
254
224
  specification_version: 4
255
225
  summary: Used by Legion to connect with RabbitMQ
256
226
  test_files: []
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'bundler/setup'
4
- require 'legion/transport'
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require 'irb'
14
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here