sidekiq-amigo 1.4.2 → 1.5.0

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: d11b55a48aa6ca5d7da7217b242c10d13475138071ea22920adcd19a5c8569b2
4
- data.tar.gz: 7d6166c366e1299b27e7128ce2db12792ef4cf74a57e932240cf7b288c49827c
3
+ metadata.gz: 70d47770af144a84aedec89e8b74e4ebd13851119a5c329a0f4c65d56ec94a60
4
+ data.tar.gz: 69305abac1bb5eeb00eaf81613e591476bf1acb35cdac50dcc97a094d255aab8
5
5
  SHA512:
6
- metadata.gz: 61b2bfef602cb1afc8dd06715f717349850065aad462dc4b1a2f39fd4307f96d0d72aefa47b42c3223d71140cb9aee2497522b0efd3063129286a4d2649acb1a
7
- data.tar.gz: 17a639b371af4fb0a42d34fa5bc9358ca4daff76790c70081d463442bdeb3e3d33f7c4959c3e48e2bc59b2d3ad1ae62c872c6afb7de9ba529deef3854ea85c47
6
+ metadata.gz: adf9aa76c352c9ddb9832f142d415b4efded423324dd78a87cfc3140a755eb266dd1a1b80e15a2f911ccafaaf8ea89f416d66dfe25a17955709fb1e4828554ef
7
+ data.tar.gz: f69c16bfd06a7ea5cc3ac15db4a962f3fb02345db60ac6f581123bf5425627775bb1958e9f99ff0be8b5956db57d4c6fec64d5422ff7903c0157bf0a0f8ba4d1
data/lib/amigo/router.rb CHANGED
@@ -11,7 +11,13 @@ module Amigo
11
11
  def perform(event_json)
12
12
  event_name = event_json["name"]
13
13
  matches = Amigo.registered_event_jobs.
14
- select { |job| File.fnmatch(job.pattern, event_name, File::FNM_EXTGLOB) }
14
+ select do |job|
15
+ if job.pattern.is_a?(Regexp)
16
+ job.pattern.match(event_name)
17
+ else
18
+ File.fnmatch(job.pattern, event_name, File::FNM_EXTGLOB)
19
+ end
20
+ end
15
21
  matches.each do |job|
16
22
  Amigo.synchronous_mode ? job.new.perform(event_json) : job.perform_async(event_json)
17
23
  end
data/lib/amigo/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Amigo
4
- VERSION = "1.4.2"
4
+ VERSION = "1.5.0"
5
5
  end
data/lib/amigo.rb CHANGED
@@ -57,6 +57,9 @@ require "sidekiq-cron"
57
57
  # The 'on' pattern can be 'myapp.customer.*' to match all customer events for example,
58
58
  # or '*' to match all events. The rules of matching follow File.fnmatch.
59
59
  #
60
+ # The 'on' pattern also accepts regular expressions, like /^myapp\.customer\.[a-z]+$/,
61
+ # to control the matching rules more closely than File.fnmatch can provide.
62
+ #
60
63
  # Jobs must implement a `_perform` method, which takes a Amigo::Event.
61
64
  # Note that normal Sidekiq workers use a 'perform' method that takes a variable number of arguments;
62
65
  # the base Async::Job class has this method and delegates its business logic to the subclass _perform method.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-amigo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lithic Technology
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-01 00:00:00.000000000 Z
11
+ date: 2023-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq