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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cfdaa60184f19d01fd1609144d0b3bf07d4cb0c1f186f4057951a0be52830baa
4
- data.tar.gz: 96a9be57f09b9eedaaf03ad1b6470a77f3ff23b6d5368ef728e1185eb649a9fa
3
+ metadata.gz: cb3c747b85ec69477a5694b82dfd6841056b315a86322dded93f2fbb5b3aa13c
4
+ data.tar.gz: e01aa76838d8391e5289183303623349b6258b4265b3dda6b8bfb4b14cde42ca
5
5
  SHA512:
6
- metadata.gz: b10a559f1afbe287584d82e4a345c2929372327ba719d930f751a0bd03a365e170f11b117cf063eb8d0c816e98a9a8dc2d0bb4271628a9d697511bd062c8011a
7
- data.tar.gz: b3a9ef0cbc3234852b4f2a5e6afbb909e2cbc0b184e330f665dda6d1ee8c165fe2f07fc555f0f6e49d65d219da8745ef816eadf1bde4bedf4131c93f2d7a8fb3
6
+ metadata.gz: 68f8c77089b5fd7784af2d22dbe836c529fc862688fa8c6f42dd3004312ec518d886458c3ca4b28cac08c8d9c823b55893f11a37a05de3eab872fc7a3529bf04
7
+ data.tar.gz: 286dd6f0693b320afe381728fbb45de6964fea94d84d0258dffbc608f528684a347831249c13e0f4b3c97ebeb3fa790f4c193fdf096b4532300d3b8158654abe
@@ -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
@@ -13,7 +13,7 @@ module CanvasSync::JobUniqueness
13
13
  end
14
14
 
15
15
  def schedule_in
16
- lock_context.config[:reschedule_in] || 5
16
+ lock_context.config[:reschedule_in] || 60
17
17
  end
18
18
  end
19
19
  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.beta3".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.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-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