dispatch-rider 1.9.0 → 2.0.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.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +50 -0
  3. data/.github/workflows/rubocop-challenger.yml +26 -0
  4. data/.gitignore +1 -0
  5. data/.rubocop.yml +31 -20
  6. data/.rubocop_todo.yml +904 -0
  7. data/CHANGELOG.md +12 -0
  8. data/README.md +2 -2
  9. data/dispatch-rider.gemspec +16 -10
  10. data/gemfiles/Gemfile-5-2 +8 -0
  11. data/gemfiles/Gemfile-6-0 +8 -0
  12. data/gemfiles/Gemfile-6-1 +8 -0
  13. data/gemfiles/Gemfile-7-0 +8 -0
  14. data/lib/dispatch-rider/callbacks/access.rb +0 -1
  15. data/lib/dispatch-rider/callbacks/storage.rb +0 -2
  16. data/lib/dispatch-rider/callbacks/support.rb +0 -2
  17. data/lib/dispatch-rider/command.rb +0 -2
  18. data/lib/dispatch-rider/demultiplexer.rb +0 -1
  19. data/lib/dispatch-rider/dispatcher.rb +0 -2
  20. data/lib/dispatch-rider/error_handlers.rb +0 -1
  21. data/lib/dispatch-rider/handlers/inheritance_tracking.rb +0 -2
  22. data/lib/dispatch-rider/handlers/named_process.rb +0 -2
  23. data/lib/dispatch-rider/integrations/appsignal.rb +0 -2
  24. data/lib/dispatch-rider/logging/json_formatter.rb +0 -2
  25. data/lib/dispatch-rider/logging/lifecycle_logger.rb +0 -1
  26. data/lib/dispatch-rider/logging/text_formatter.rb +1 -3
  27. data/lib/dispatch-rider/logging/translator/base_translator.rb +0 -2
  28. data/lib/dispatch-rider/logging/translator/complete_translator.rb +0 -2
  29. data/lib/dispatch-rider/logging/translator/error_handler_fail_translator.rb +0 -2
  30. data/lib/dispatch-rider/logging/translator/fail_translator.rb +0 -2
  31. data/lib/dispatch-rider/logging/translator/start_translator.rb +0 -2
  32. data/lib/dispatch-rider/logging/translator/stop_translator.rb +0 -2
  33. data/lib/dispatch-rider/logging/translator/success_translator.rb +0 -2
  34. data/lib/dispatch-rider/logging/translator.rb +0 -2
  35. data/lib/dispatch-rider/logging.rb +0 -1
  36. data/lib/dispatch-rider/notification_services/aws_sns.rb +4 -4
  37. data/lib/dispatch-rider/notification_services/base.rb +1 -1
  38. data/lib/dispatch-rider/notification_services/file_system/channel.rb +1 -2
  39. data/lib/dispatch-rider/notification_services/file_system/notifier.rb +0 -2
  40. data/lib/dispatch-rider/publisher/configuration/destination.rb +0 -2
  41. data/lib/dispatch-rider/publisher/configuration/notification_service.rb +0 -2
  42. data/lib/dispatch-rider/publisher/configuration.rb +0 -2
  43. data/lib/dispatch-rider/publisher/configuration_reader.rb +0 -3
  44. data/lib/dispatch-rider/publisher/configuration_support.rb +0 -2
  45. data/lib/dispatch-rider/queue_services/aws_sqs/sqs_received_message.rb +6 -7
  46. data/lib/dispatch-rider/queue_services/aws_sqs.rb +28 -20
  47. data/lib/dispatch-rider/queue_services/file_system/fs_received_message.rb +0 -1
  48. data/lib/dispatch-rider/queue_services/file_system.rb +2 -2
  49. data/lib/dispatch-rider/queue_services/received_message.rb +0 -2
  50. data/lib/dispatch-rider/registrars/base.rb +2 -2
  51. data/lib/dispatch-rider/registrars/sns_channel.rb +1 -1
  52. data/lib/dispatch-rider/runner.rb +0 -1
  53. data/lib/dispatch-rider/version.rb +1 -1
  54. data/lib/dispatch-rider.rb +2 -0
  55. data/lib/generators/dispatch_rider/install/install_generator.rb +0 -2
  56. data/lib/generators/dispatch_rider/job/dispatch_job_generator.rb +0 -2
  57. data/spec/factories/messages.rb +7 -6
  58. data/spec/lib/dispatch-rider/callbacks/access_spec.rb +2 -2
  59. data/spec/lib/dispatch-rider/callbacks/storage_spec.rb +3 -3
  60. data/spec/lib/dispatch-rider/configuration_spec.rb +1 -1
  61. data/spec/lib/dispatch-rider/default_error_handler_spec.rb +1 -0
  62. data/spec/lib/dispatch-rider/demultiplexer_spec.rb +2 -2
  63. data/spec/lib/dispatch-rider/notification_services/aws_sns_spec.rb +3 -3
  64. data/spec/lib/dispatch-rider/notification_services/base_spec.rb +7 -7
  65. data/spec/lib/dispatch-rider/notification_services/file_system/channel_spec.rb +5 -4
  66. data/spec/lib/dispatch-rider/publisher/base_spec.rb +2 -2
  67. data/spec/lib/dispatch-rider/publisher/configuration/destination_spec.rb +1 -2
  68. data/spec/lib/dispatch-rider/publisher/configuration/notification_service_spec.rb +1 -2
  69. data/spec/lib/dispatch-rider/publisher/configuration_spec.rb +2 -2
  70. data/spec/lib/dispatch-rider/publisher_spec.rb +2 -1
  71. data/spec/lib/dispatch-rider/queue_services/aws_sqs_spec.rb +24 -34
  72. data/spec/lib/dispatch-rider/queue_services/file_system_spec.rb +2 -2
  73. data/spec/lib/dispatch-rider/scheduled_job_spec.rb +12 -12
  74. data/spec/lib/dispatch-rider/subscriber_spec.rb +4 -0
  75. data/spec/spec_helper.rb +32 -4
  76. data/spec/support/integration_support.rb +0 -1
  77. metadata +92 -32
  78. data/.rubocop.hound.yml +0 -261
  79. data/spec/lib/dispatch-rider/queue_services_spec.rb +0 -6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Change Log
2
2
 
3
+ ## [v2.0.0](https://github.com/payrollhero/dispatch-rider/tree/v2.0.0) (2022-09-20)
4
+ [Full Changelog](https://github.com/payrollhero/dispatch-rider/compare/v1.9.0...v2.0.0)
5
+
6
+ * Tests now run via Github actions
7
+ * Requires Ruby 2.6.5 at the very minimum
8
+ * Requires Rails 5.2 at the very minimum
9
+ * Supports both Aws SDK 1.x and 3.x
10
+ * aws-sdk-sqs and aws-sdk-sns are marked as optional, but strongly recommended.
11
+ * Security Update Rails (CVE-2022-32224): Automatically set the active-record config DispatchRider::ScheduledJob model.
12
+ * Tests are validated against rails 5.2.x, 6.0.x, 6.1.x and 7.0.x
13
+ * Started addressing some of the style issue and tech debt via rubocop-challenger automated PR
14
+
3
15
  ## [v1.9.0](https://github.com/payrollhero/dispatch-rider/tree/v1.9.0) (2019-11-11)
4
16
  [Full Changelog](https://github.com/payrollhero/dispatch-rider/compare/v1.8.6...v1.9.0)
5
17
 
data/README.md CHANGED
@@ -7,9 +7,9 @@ handling the messages.
7
7
 
8
8
  ### Build status
9
9
 
10
- [![Build Status](https://travis-ci.org/payrollhero/dispatch-rider.png?branch=master)](https://travis-ci.org/payrollhero/dispatch-rider)
10
+ [![build](https://github.com/payrollhero/dispatch-rider/actions/workflows/build.yml/badge.svg)](https://github.com/payrollhero/dispatch-rider/actions/workflows/build.yml)
11
+ [![Coverage Status](https://coveralls.io/repos/github/payrollhero/dispatch-rider/badge.svg)](https://coveralls.io/github/payrollhero/dispatch-rider)
11
12
  [![Code Climate](https://codeclimate.com/github/payrollhero/dispatch-rider.png)](https://codeclimate.com/github/payrollhero/dispatch-rider)
12
- [![Dependency Status](https://gemnasium.com/payrollhero/dispatch-rider.png)](https://gemnasium.com/payrollhero/dispatch-rider)
13
13
 
14
14
 
15
15
  ## Installation
@@ -28,36 +28,42 @@ Gem::Specification.new do |gem|
28
28
  "Dane Natoli",
29
29
  "Piotr Banasik",
30
30
  "Ronald Maravilla",
31
+ "Mathieu Jobin",
31
32
  ]
32
33
  gem.email = [
33
- "piotr@payrollhero.com",
34
- "rmaravilla@payrollhero.com",
34
+ "mathieu@payrollhero.com",
35
35
  ]
36
36
  gem.homepage = 'https://github.com/payrollhero/dispatch-rider'
37
37
  gem.files = `git ls-files`.split($/)
38
38
  gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
39
39
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
40
40
  gem.require_paths = ['lib']
41
- gem.required_ruby_version = '>= 2.1.8'
41
+ gem.required_ruby_version = '>= 2.6.5'
42
42
 
43
43
 
44
- gem.add_runtime_dependency 'activesupport', '>= 3.2.0'
45
- gem.add_runtime_dependency 'activemodel', '>= 3.2.0'
46
- gem.add_runtime_dependency 'activerecord', '>= 3.2.0'
44
+ gem.add_runtime_dependency 'activesupport', '>= 5.2.0'
45
+ gem.add_runtime_dependency 'activemodel', '>= 5.2.0'
46
+ gem.add_runtime_dependency 'activerecord', '>= 5.2.0'
47
47
  gem.add_runtime_dependency 'daemons', '~> 1.2'
48
48
  gem.add_runtime_dependency 'retriable', '~> 3.1', '>= 3.1.2'
49
49
  # appsignal is an optional runtime dependency,
50
50
  # I am marking it as development for those that don't need it
51
51
  gem.add_development_dependency 'appsignal', '~> 1.0'
52
52
 
53
- gem.add_development_dependency 'bundler', '~> 1.0'
53
+ gem.add_development_dependency 'aws-sdk-sqs', '~> 1.30'
54
+ gem.add_development_dependency 'aws-sdk-sns', '~> 1.30'
55
+ gem.add_development_dependency 'bundler', '< 3.0'
56
+ gem.add_development_dependency 'coveralls_reborn', '~> 0.25'
57
+ gem.add_development_dependency 'simplecov-lcov'
58
+ gem.add_development_dependency 'debug'
54
59
  gem.add_development_dependency 'rake'
55
60
  gem.add_development_dependency 'sqlite3'
56
61
  gem.add_development_dependency 'rubygems-tasks'
57
62
  gem.add_development_dependency 'github_changelog_generator'
58
63
  gem.add_development_dependency 'yard'
59
64
  gem.add_development_dependency 'rspec', '~> 3.3'
60
- gem.add_development_dependency 'factory_girl'
61
- gem.add_development_dependency 'aws-sdk', '~> 1'
62
- gem.add_development_dependency 'pry'
65
+ gem.add_development_dependency 'factory_bot'
66
+
67
+ # static analysis gems
68
+ gem.add_development_dependency 'rubocop_challenger'
63
69
  end
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec path: '..'
4
+
5
+ gem 'rails', '~> 5.2.6'
6
+ gem 'aws-sdk-sns'
7
+ gem 'aws-sdk-sqs'
8
+ gem 'aws-sdk-v1', github: 'payrollhero/aws-sdk-ruby', branch: 'v1-require-json-2.6' if ENV['AWS_SDK_VER'] == 'v1'
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec path: '..'
4
+
5
+ gem 'rails', '~> 6.0.4'
6
+ gem 'aws-sdk-sns'
7
+ gem 'aws-sdk-sqs'
8
+ gem 'aws-sdk-v1', github: 'payrollhero/aws-sdk-ruby', branch: 'v1-require-json-2.6' if ENV['AWS_SDK_VER'] == 'v1'
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec path: '..'
4
+
5
+ gem 'rails', '~> 6.1.4'
6
+ gem 'aws-sdk-sns'
7
+ gem 'aws-sdk-sqs'
8
+ gem 'aws-sdk-v1', github: 'payrollhero/aws-sdk-ruby', branch: 'v1-require-json-2.6' if ENV['AWS_SDK_VER'] == 'v1'
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec path: '..'
4
+
5
+ gem 'rails', '~> 7.0.3'
6
+ gem 'aws-sdk-sns'
7
+ gem 'aws-sdk-sqs'
8
+ gem 'aws-sdk-v1', github: 'payrollhero/aws-sdk-ruby', branch: 'v1-require-json-2.6' if ENV['AWS_SDK_VER'] == 'v1'
@@ -21,7 +21,6 @@ module DispatchRider
21
21
 
22
22
  block_with_callbacks.call
23
23
  end
24
-
25
24
  end
26
25
  end
27
26
  end
@@ -2,7 +2,6 @@ module DispatchRider
2
2
  module Callbacks
3
3
  # Storage for callbacks.
4
4
  class Storage
5
-
6
5
  def initialize
7
6
  @callbacks = Hash.new { |storage, key| storage[key] = [] }
8
7
  end
@@ -41,7 +40,6 @@ module DispatchRider
41
40
  def for(event)
42
41
  @callbacks[event]
43
42
  end
44
-
45
43
  end
46
44
  end
47
45
  end
@@ -2,13 +2,11 @@ module DispatchRider
2
2
  module Callbacks
3
3
  # Adds callback support to an object.
4
4
  module Support
5
-
6
5
  private
7
6
 
8
7
  def callbacks
9
8
  @callbacks ||= Callbacks::Access.new DispatchRider.config.callbacks
10
9
  end
11
-
12
10
  end
13
11
  end
14
12
  end
@@ -4,7 +4,6 @@ require 'optparse'
4
4
 
5
5
  module DispatchRider
6
6
  class Command
7
-
8
7
  def initialize(options = {})
9
8
  @app_home = Pathname.new(Dir.getwd)
10
9
  @options = {
@@ -51,6 +50,5 @@ module DispatchRider
51
50
  end
52
51
  @opts = opts.parse!(args)
53
52
  end
54
-
55
53
  end
56
54
  end
@@ -85,6 +85,5 @@ module DispatchRider
85
85
  def logger
86
86
  DispatchRider.config.logger
87
87
  end
88
-
89
88
  end
90
89
  end
@@ -25,7 +25,5 @@ module DispatchRider
25
25
  end
26
26
  true # success => true (delete message)
27
27
  end
28
-
29
-
30
28
  end
31
29
  end
@@ -1,5 +1,4 @@
1
1
  module DispatchRider
2
-
3
2
  # This is the default error handler for dispatch rider.
4
3
  # It simply re-raises the exception.
5
4
  module DefaultErrorHandler
@@ -4,7 +4,6 @@
4
4
  module DispatchRider
5
5
  module Handlers
6
6
  module InheritanceTracking
7
-
8
7
  def inherited(subclass)
9
8
  subclasses << subclass
10
9
  super
@@ -13,7 +12,6 @@ module DispatchRider
13
12
  def subclasses
14
13
  @subclasses ||= Set.new
15
14
  end
16
-
17
15
  end
18
16
  end
19
17
  end
@@ -1,7 +1,6 @@
1
1
  module DispatchRider
2
2
  module Handlers
3
3
  module NamedProcess
4
-
5
4
  def with_named_process(message)
6
5
  original_program_name = $0
7
6
  begin
@@ -11,7 +10,6 @@ module DispatchRider
11
10
  $0 = original_program_name
12
11
  end
13
12
  end
14
-
15
13
  end
16
14
  end
17
15
  end
@@ -4,7 +4,6 @@ if defined? Appsignal
4
4
  module DispatchRider
5
5
  module Integrations
6
6
  module Appsignal
7
-
8
7
  def self.wrap_message(job, message)
9
8
  ::Appsignal.start
10
9
 
@@ -21,7 +20,6 @@ if defined? Appsignal
21
20
 
22
21
  ::Appsignal.stop
23
22
  end
24
-
25
23
  end
26
24
  end
27
25
  end
@@ -4,11 +4,9 @@ require 'json'
4
4
  module DispatchRider
5
5
  module Logging
6
6
  class JsonFormatter
7
-
8
7
  def format(data)
9
8
  data.to_json
10
9
  end
11
-
12
10
  end
13
11
  end
14
12
  end
@@ -89,7 +89,6 @@ module DispatchRider
89
89
  when :start, :stop, :complete, :success then :info
90
90
  end
91
91
  end
92
-
93
92
  end
94
93
  end
95
94
  end
@@ -2,7 +2,6 @@
2
2
  module DispatchRider
3
3
  module Logging
4
4
  class TextFormatter
5
-
6
5
  def format(data)
7
6
  case data[:phase]
8
7
  when :complete
@@ -14,7 +13,7 @@ module DispatchRider
14
13
  when :success
15
14
  "Succeeded execution of: #{message_info_fragment(data)}"
16
15
  when :stop
17
- "Got stop #{data[:reason] ? '(' + data[:reason] + ')' : '' } while executing: #{message_info_fragment(data)}"
16
+ "Got stop #{data[:reason] ? '(' + data[:reason] + ')' : ''} while executing: #{message_info_fragment(data)}"
18
17
  when :error_handler_fail
19
18
  "Failed error handling of: #{exception_info_fragment(data)}"
20
19
  else
@@ -42,7 +41,6 @@ module DispatchRider
42
41
  def format_duration(duration)
43
42
  '%.2f' % [duration]
44
43
  end
45
-
46
44
  end
47
45
  end
48
46
  end
@@ -1,7 +1,6 @@
1
1
  module DispatchRider
2
2
  module Logging
3
3
  class Translator
4
-
5
4
  class BaseTranslator
6
5
  def initialize(message, **)
7
6
  @message = message
@@ -38,7 +37,6 @@ module DispatchRider
38
37
  message_info_fragment(message).merge exception_details
39
38
  end
40
39
  end
41
-
42
40
  end
43
41
  end
44
42
  end
@@ -1,7 +1,6 @@
1
1
  module DispatchRider
2
2
  module Logging
3
3
  class Translator
4
-
5
4
  class CompleteTranslator < BaseTranslator
6
5
  def initialize(message, duration:)
7
6
  super(message)
@@ -12,7 +11,6 @@ module DispatchRider
12
11
  message_info_fragment(@message).merge duration: @duration
13
12
  end
14
13
  end
15
-
16
14
  end
17
15
  end
18
16
  end
@@ -1,10 +1,8 @@
1
1
  module DispatchRider
2
2
  module Logging
3
3
  class Translator
4
-
5
4
  class ErrorHandlerFailTranslator < FailTranslator
6
5
  end
7
-
8
6
  end
9
7
  end
10
8
  end
@@ -1,7 +1,6 @@
1
1
  module DispatchRider
2
2
  module Logging
3
3
  class Translator
4
-
5
4
  class FailTranslator < BaseTranslator
6
5
  def initialize(message, exception:)
7
6
  super(message)
@@ -12,7 +11,6 @@ module DispatchRider
12
11
  exception_info_fragment(@message, @exception)
13
12
  end
14
13
  end
15
-
16
14
  end
17
15
  end
18
16
  end
@@ -1,13 +1,11 @@
1
1
  module DispatchRider
2
2
  module Logging
3
3
  class Translator
4
-
5
4
  class StartTranslator < BaseTranslator
6
5
  def translate
7
6
  message_info_fragment(@message)
8
7
  end
9
8
  end
10
-
11
9
  end
12
10
  end
13
11
  end
@@ -1,7 +1,6 @@
1
1
  module DispatchRider
2
2
  module Logging
3
3
  class Translator
4
-
5
4
  class StopTranslator < BaseTranslator
6
5
  def initialize(message, reason:)
7
6
  super(message)
@@ -12,7 +11,6 @@ module DispatchRider
12
11
  message_info_fragment(@message).merge reason: @reason
13
12
  end
14
13
  end
15
-
16
14
  end
17
15
  end
18
16
  end
@@ -1,10 +1,8 @@
1
1
  module DispatchRider
2
2
  module Logging
3
3
  class Translator
4
-
5
4
  class SuccessTranslator < StartTranslator
6
5
  end
7
-
8
6
  end
9
7
  end
10
8
  end
@@ -1,6 +1,5 @@
1
1
  module DispatchRider
2
2
  module Logging
3
-
4
3
  # Translates a message into a loggable hash based on its result.
5
4
  class Translator
6
5
  def self.translate(message, kind, **args)
@@ -13,7 +12,6 @@ module DispatchRider
13
12
  const_get("#{kind}_translator".classify)
14
13
  end
15
14
  end
16
-
17
15
  end
18
16
  end
19
17
 
@@ -1,6 +1,5 @@
1
1
  module DispatchRider
2
2
  module Logging
3
-
4
3
  end
5
4
  end
6
5
 
@@ -6,7 +6,7 @@ module DispatchRider
6
6
  module NotificationServices
7
7
  class AwsSns < Base
8
8
  def notifier_builder
9
- AWS::SNS
9
+ Aws::SNS::Client
10
10
  rescue NameError
11
11
  raise AdapterNotFoundError.new(self.class.name, 'aws-sdk')
12
12
  end
@@ -16,15 +16,15 @@ module DispatchRider
16
16
  end
17
17
 
18
18
  def publish_to_channel(channel, message:)
19
- Retriable.retriable(tries: 10, on: AWS::Errors::MissingCredentialsError) { super }
19
+ Retriable.retriable(tries: 10, on: Aws::Errors::MissingCredentialsError) { super }
20
20
  end
21
21
 
22
22
  # not really happy with this, but the notification service registrar system is way too rigid to do this cleaner
23
23
  # since you only can have one notifier for the whole service, but you need to create a new one for each region
24
24
  def channel(name)
25
25
  arn = self.fetch(name)
26
- region = arn.split(':')[3]
27
- notifier_builder.new(region: region).topics[arn]
26
+ # in v1, the Topic object was fetched from API, in v3 it's basically just an arn wrapper
27
+ Aws::SNS::Topic.new(arn)
28
28
  end
29
29
  end
30
30
  end
@@ -41,7 +41,7 @@ module DispatchRider
41
41
  end
42
42
 
43
43
  def publish_to_channel(channel, message:)
44
- channel.publish(serialize(message))
44
+ channel.publish(message: serialize(message))
45
45
  end
46
46
 
47
47
  private
@@ -3,13 +3,12 @@
3
3
  module DispatchRider
4
4
  module NotificationServices
5
5
  class FileSystem::Channel
6
-
7
6
  def initialize(path)
8
7
  @file_system_queue = DispatchRider::QueueServices::FileSystem::Queue.new(path)
9
8
  end
10
9
 
11
10
  def publish(message)
12
- @file_system_queue.add(message)
11
+ @file_system_queue.add(message[:message])
13
12
  end
14
13
  end
15
14
  end
@@ -3,7 +3,6 @@
3
3
  module DispatchRider
4
4
  module NotificationServices
5
5
  class FileSystem::Notifier
6
-
7
6
  def initialize(options)
8
7
  # nothing to do here
9
8
  end
@@ -11,7 +10,6 @@ module DispatchRider
11
10
  def channel(path)
12
11
  FileSystem::Channel.new(path)
13
12
  end
14
-
15
13
  end
16
14
  end
17
15
  end
@@ -1,6 +1,5 @@
1
1
  module DispatchRider
2
2
  class Publisher::Configuration::Destination
3
-
4
3
  def initialize(name, attributes={})
5
4
  @name = name
6
5
 
@@ -18,6 +17,5 @@ module DispatchRider
18
17
  self.channel == other.channel &&
19
18
  self.options == other.options
20
19
  end
21
-
22
20
  end
23
21
  end
@@ -1,6 +1,5 @@
1
1
  module DispatchRider
2
2
  class Publisher::Configuration::NotificationService
3
-
4
3
  def initialize(name, options)
5
4
  @name = name
6
5
  @options = options
@@ -12,6 +11,5 @@ module DispatchRider
12
11
  self.name == other.name &&
13
12
  self.options == other.options
14
13
  end
15
-
16
14
  end
17
15
  end
@@ -1,6 +1,5 @@
1
1
  module DispatchRider
2
2
  class Publisher::Configuration
3
-
4
3
  def initialize(configuration_hash = {})
5
4
  @notification_services = []
6
5
  @destinations = []
@@ -41,7 +40,6 @@ module DispatchRider
41
40
  @destinations << Destination.new(name, options)
42
41
  end
43
42
  end
44
-
45
43
  end
46
44
  end
47
45
 
@@ -1,7 +1,6 @@
1
1
  module DispatchRider
2
2
  class Publisher
3
3
  module ConfigurationReader
4
-
5
4
  class << self
6
5
  def load_config(configuration, publisher)
7
6
  configure_notification_services(configuration.notification_services, publisher)
@@ -21,9 +20,7 @@ module DispatchRider
21
20
  publisher.register_destination(destination.name, destination.service, destination.channel, destination.options)
22
21
  end
23
22
  end
24
-
25
23
  end
26
-
27
24
  end
28
25
  end
29
26
  end
@@ -1,7 +1,6 @@
1
1
  module DispatchRider
2
2
  class Publisher
3
3
  module ConfigurationSupport
4
-
5
4
  def configuration
6
5
  @configuration ||= Configuration.new
7
6
  end
@@ -14,7 +13,6 @@ module DispatchRider
14
13
  configuration.parse(configuration_hash)
15
14
  end
16
15
  end
17
-
18
16
  end
19
17
  end
20
18
  end
@@ -3,14 +3,14 @@ module DispatchRider
3
3
  class AwsSqs < Base
4
4
  class SqsReceivedMessage < ReceivedMessage
5
5
  attr_reader :total_timeout, :start_time
6
-
7
- def initialize(message, raw_item, queue)
6
+
7
+ def initialize(message, raw_item, queue, queue_visibility_timeout)
8
8
  @queue = queue
9
- @total_timeout = queue.visibility_timeout
9
+ @total_timeout = queue_visibility_timeout.to_i
10
10
  @start_time = Time.now
11
11
  super(message, raw_item)
12
12
  end
13
-
13
+
14
14
  # NOTE: Setting the visibility timeout resets the timeout to NOW and makes it visibility timeout this time
15
15
  # Essentially resetting the timer on this message
16
16
  def extend_timeout(timeout)
@@ -19,7 +19,7 @@ module DispatchRider
19
19
  @total_timeout = timeout + (Time.now - start_time).to_i
20
20
  end
21
21
  end
22
-
22
+
23
23
  # We effectively return the item to the queue by setting
24
24
  # the visibility timeout to zero. The item
25
25
  # should become immediately visible.
@@ -38,9 +38,8 @@ module DispatchRider
38
38
  end
39
39
 
40
40
  def queue_name
41
- @queue.arn.split(':').last
41
+ @item.queue_arn.split(':').last
42
42
  end
43
-
44
43
  end
45
44
  end
46
45
  end