canvas_sync 0.22.0.beta1 → 0.22.0.beta2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f694edf9c88f7441ccdb66d6a58f4ed31701c56682c70af20f5e7fbaf2c829b3
|
4
|
+
data.tar.gz: a3438e037e06694ce521d289cfab8598b9d5fc8c76e2bc553d938f1515287a8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89f0c9f0dc1a0cca1d74771085712e6f6e6a5acf75979beaa06bd2d2e0db2092769547abb8debee12bd98e025bc1b34ef4ebfb75bf991b8bc7ed9ee752d19196
|
7
|
+
data.tar.gz: d7095273e6e299ee1b1d1e6089e451c6a3dd86e37e87e39401c112e91754c708243e226ae7116a768ad868bb54f4ce3aeb9b10d3736b179c6c2e2a67d6e1edf2
|
@@ -8,9 +8,30 @@ module CanvasSync::JobUniqueness
|
|
8
8
|
autoload :NullStrategy
|
9
9
|
autoload :Raise
|
10
10
|
autoload :Reject
|
11
|
-
# autoload :Replace
|
12
11
|
autoload :Reschedule
|
13
12
|
|
13
|
+
# Replace is... hard. It involves hacking into some of the inner workings of Sidekiq and/or ActiveJob.
|
14
|
+
# The best solution would be to somehow mark the previously-scheduled job as dead and let it be picked up by workers but not invoke
|
15
|
+
# its perform method (technically this would mess with success numbers, but does anybody really care about those?).
|
16
|
+
# Replace will also conflict with the UntilExecuted strategy as it wouldn't be able to replace a job that has begun executing.
|
17
|
+
#
|
18
|
+
# Replace is useful for two cases:
|
19
|
+
# 1. Moving the job to the back of the queue, eg for debouncing purposes
|
20
|
+
# 2. Replacing non-hashed params with updated values
|
21
|
+
# A solution to (2) would be to store the latest params outside of the Job params - eg in the DB or in Redis directly.
|
22
|
+
# (1) is solvebale in a similar out-of-band way, but other, better solutions may exist as well
|
23
|
+
#
|
24
|
+
# If the param in question is a (eg) a list that you want to append to, you could:
|
25
|
+
# Push to the list in Redis
|
26
|
+
# Queue the job
|
27
|
+
# (Push another param to the list in Redis)
|
28
|
+
# (Re-enqueue the job, but it won't enqueue because it is locked)
|
29
|
+
# When the job begins, it pulls all values from the field in Redis an processes
|
30
|
+
# Adding more params from this point would allow another job to enqueue
|
31
|
+
#
|
32
|
+
# We may implement some tooling for this at some point, but for now the recommendation is to handle this yourself,
|
33
|
+
# autoload :Replace
|
34
|
+
|
14
35
|
class << self
|
15
36
|
def lookup(strategy)
|
16
37
|
matching_strategy(strategy.to_s.camelize) ||
|
@@ -10,7 +10,7 @@ module CanvasSync::JobUniqueness
|
|
10
10
|
class_methods do
|
11
11
|
# ensure_uniqueness(
|
12
12
|
# strategy: :until_executed, # :until_executed, :until_executing, :until_expired, :until_and_while_executing, :while_executing
|
13
|
-
# on_conflict: :raise, # :raise, :
|
13
|
+
# on_conflict: :raise, # :raise, :log, :reject, :reschedule, { enqueue: ..., perform: ... }, proc
|
14
14
|
# lock_ttl: 7.days, # seconds
|
15
15
|
# lock_timeout: 0, # seconds
|
16
16
|
|
@@ -32,7 +32,7 @@ module CanvasSync::JobUniqueness
|
|
32
32
|
begin
|
33
33
|
require "sidekiq_unique_jobs"
|
34
34
|
rescue LoadError
|
35
|
-
raise LoadError, "
|
35
|
+
raise LoadError, "sidekiq-unique-jobs is required for ensure_uniqueness"
|
36
36
|
end
|
37
37
|
|
38
38
|
OnConflict.validate!(kwargs[:on_conflict], kwargs[:strategy]) if kwargs[:on_conflict].present?
|
data/lib/canvas_sync/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: canvas_sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.22.0.
|
4
|
+
version: 0.22.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Instructure CustomDev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-07-
|
11
|
+
date: 2024-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|