canvas_sync 0.22.0.beta1 → 0.22.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/canvas_sync/job_uniqueness/compat/active_job.rb +1 -1
- data/lib/canvas_sync/job_uniqueness/on_conflict/reschedule.rb +1 -1
- data/lib/canvas_sync/job_uniqueness/on_conflict.rb +22 -1
- data/lib/canvas_sync/job_uniqueness/unique_job_common.rb +2 -2
- data/lib/canvas_sync/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb3c747b85ec69477a5694b82dfd6841056b315a86322dded93f2fbb5b3aa13c
|
4
|
+
data.tar.gz: e01aa76838d8391e5289183303623349b6258b4265b3dda6b8bfb4b14cde42ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68f8c77089b5fd7784af2d22dbe836c529fc862688fa8c6f42dd3004312ec518d886458c3ca4b28cac08c8d9c823b55893f11a37a05de3eab872fc7a3529bf04
|
7
|
+
data.tar.gz: 286dd6f0693b320afe381728fbb45de6964fea94d84d0258dffbc608f528684a347831249c13e0f4b3c97ebeb3fa790f4c193fdf096b4532300d3b8158654abe
|
@@ -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.beta3
|
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
|