canvas_sync 0.22.0.beta1 → 0.22.0.beta2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cfdaa60184f19d01fd1609144d0b3bf07d4cb0c1f186f4057951a0be52830baa
4
- data.tar.gz: 96a9be57f09b9eedaaf03ad1b6470a77f3ff23b6d5368ef728e1185eb649a9fa
3
+ metadata.gz: f694edf9c88f7441ccdb66d6a58f4ed31701c56682c70af20f5e7fbaf2c829b3
4
+ data.tar.gz: a3438e037e06694ce521d289cfab8598b9d5fc8c76e2bc553d938f1515287a8e
5
5
  SHA512:
6
- metadata.gz: b10a559f1afbe287584d82e4a345c2929372327ba719d930f751a0bd03a365e170f11b117cf063eb8d0c816e98a9a8dc2d0bb4271628a9d697511bd062c8011a
7
- data.tar.gz: b3a9ef0cbc3234852b4f2a5e6afbb909e2cbc0b184e330f665dda6d1ee8c165fe2f07fc555f0f6e49d65d219da8745ef816eadf1bde4bedf4131c93f2d7a8fb3
6
+ metadata.gz: 89f0c9f0dc1a0cca1d74771085712e6f6e6a5acf75979beaa06bd2d2e0db2092769547abb8debee12bd98e025bc1b34ef4ebfb75bf991b8bc7ed9ee752d19196
7
+ data.tar.gz: d7095273e6e299ee1b1d1e6089e451c6a3dd86e37e87e39401c112e91754c708243e226ae7116a768ad868bb54f4ce3aeb9b10d3736b179c6c2e2a67d6e1edf2
@@ -11,7 +11,7 @@ module CanvasSync::JobUniqueness
11
11
  def reenqueue(schedule_in:)
12
12
  job_class.set(
13
13
  queue: job_queue.to_sym,
14
- set: schedule_in,
14
+ wait: schedule_in,
15
15
  priortity: job_instance.priority,
16
16
  ).perform_later(*job_instance.arguments)
17
17
  end
@@ -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, :replace, :log, :reject, :reschedule, { enqueue: ..., perform: ... }, proc
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, "SidekiqUniqueJobs is required for ensure_uniqueness"
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?
@@ -1,3 +1,3 @@
1
1
  module CanvasSync
2
- VERSION = "0.22.0.beta1".freeze
2
+ VERSION = "0.22.0.beta2".freeze
3
3
  end
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.beta1
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-24 00:00:00.000000000 Z
11
+ date: 2024-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails