canvas_sync 0.23.5 → 0.24.0.beta1
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 +4 -4
- data/Rakefile +2 -4
- data/lib/canvas_sync/version.rb +1 -1
- data/lib/canvas_sync.rb +6 -4
- data/spec/canvas_sync/canvas_sync_spec.rb +11 -11
- data/spec/canvas_sync/live_events/process_event_job_spec.rb +1 -0
- data/spec/{dummy → internal}/app/models/application_record.rb +1 -0
- data/spec/{dummy → internal}/app/models/content_migration.rb +0 -0
- data/spec/{dummy → internal}/app/models/course.rb +0 -1
- data/spec/{dummy → internal}/app/models/course_nickname.rb +0 -0
- data/spec/{dummy → internal}/app/models/learning_outcome.rb +0 -0
- data/spec/{dummy → internal}/app/services/live_events/assignment_event.rb +0 -0
- data/spec/{dummy → internal}/app/services/live_events/course_event.rb +0 -0
- data/spec/{dummy → internal}/app/services/live_events/course_section_event.rb +0 -0
- data/spec/{dummy → internal}/app/services/live_events/enrollment_event.rb +0 -0
- data/spec/{dummy → internal}/app/services/live_events/grade_event.rb +0 -0
- data/spec/{dummy → internal}/app/services/live_events/module_event.rb +0 -0
- data/spec/{dummy → internal}/app/services/live_events/module_item_event.rb +0 -0
- data/spec/{dummy → internal}/app/services/live_events/submission_event.rb +0 -0
- data/spec/{dummy → internal}/app/services/live_events/syllabus_event.rb +0 -0
- data/spec/{dummy → internal}/app/services/live_events/user_event.rb +0 -0
- data/spec/internal/bin/rails +9 -0
- data/spec/internal/config/database.yml +5 -0
- data/spec/internal/config/routes.rb +5 -0
- data/spec/internal/config/storage.yml +3 -0
- data/spec/{dummy/db/migrate/20220926221926_create_users.rb → internal/db/migrate/20250912205136_create_users.rb} +0 -0
- data/spec/{dummy/db/migrate/20201016181346_create_pseudonyms.rb → internal/db/migrate/20250912205137_create_pseudonyms.rb} +0 -0
- data/spec/{dummy/db/migrate/20200415171620_create_groups.rb → internal/db/migrate/20250912205139_create_groups.rb} +0 -0
- data/spec/{dummy/db/migrate/20200416214248_create_group_memberships.rb → internal/db/migrate/20250912205140_create_group_memberships.rb} +0 -0
- data/spec/{dummy/db/migrate/20190702203622_create_accounts.rb → internal/db/migrate/20250912205141_create_accounts.rb} +0 -0
- data/spec/{dummy/db/migrate/20190702203623_create_terms.rb → internal/db/migrate/20250912205142_create_terms.rb} +0 -0
- data/spec/{dummy/db/migrate/20190702203625_create_sections.rb → internal/db/migrate/20250912205144_create_sections.rb} +0 -0
- data/spec/{dummy/db/migrate/20190702203626_create_assignments.rb → internal/db/migrate/20250912205145_create_assignments.rb} +0 -0
- data/spec/{dummy/db/migrate/20190702203627_create_submissions.rb → internal/db/migrate/20250912205146_create_submissions.rb} +0 -0
- data/spec/{dummy/db/migrate/20190927204545_create_roles.rb → internal/db/migrate/20250912205147_create_roles.rb} +2 -2
- data/spec/{dummy/db/migrate/20190927204546_create_admins.rb → internal/db/migrate/20250912205148_create_admins.rb} +0 -0
- data/spec/{dummy/db/migrate/20190702203630_create_assignment_groups.rb → internal/db/migrate/20250912205149_create_assignment_groups.rb} +0 -0
- data/spec/{dummy/db/migrate/20190702203631_create_context_modules.rb → internal/db/migrate/20250912205150_create_context_modules.rb} +0 -0
- data/spec/{dummy/db/migrate/20190702203632_create_context_module_items.rb → internal/db/migrate/20250912205151_create_context_module_items.rb} +0 -0
- data/spec/{dummy/db/migrate/20210907233329_create_user_observers.rb → internal/db/migrate/20250912205152_create_user_observers.rb} +0 -0
- data/spec/{dummy/db/migrate/20210907233330_create_grading_periods.rb → internal/db/migrate/20250912205153_create_grading_periods.rb} +0 -0
- data/spec/{dummy/db/migrate/20211001184920_create_grading_period_groups.rb → internal/db/migrate/20250912205154_create_grading_period_groups.rb} +0 -0
- data/spec/{dummy/db/migrate/20220308072643_create_content_migrations.rb → internal/db/migrate/20250912205155_create_content_migrations.rb} +0 -0
- data/spec/{dummy/db/migrate/20220712210559_create_learning_outcomes.rb → internal/db/migrate/20250912205156_create_learning_outcomes.rb} +0 -0
- data/spec/{dummy/db/migrate/20240523101010_create_learning_outcome_results.rb → internal/db/migrate/20250912205157_create_learning_outcome_results.rb} +0 -0
- data/spec/{dummy/db/migrate/20240510094100_create_rubric_associations.rb → internal/db/migrate/20250912205160_create_rubric_associations.rb} +0 -0
- data/spec/{dummy/db/migrate/20240510101100_create_rubric_assessments.rb → internal/db/migrate/20250912205161_create_rubric_assessments.rb} +0 -0
- data/spec/{dummy/db/migrate/20240828161300_create_course_progresses.rb → internal/db/migrate/20250912205162_create_course_progresses.rb} +0 -0
- data/spec/internal/db/schema.rb +6 -0
- data/spec/spec_helper.rb +8 -4
- metadata +182 -372
- data/lib/canvas_sync/job_batches/batch.rb +0 -595
- data/lib/canvas_sync/job_batches/callback.rb +0 -135
- data/lib/canvas_sync/job_batches/chain_builder.rb +0 -247
- data/lib/canvas_sync/job_batches/compat/active_job.rb +0 -108
- data/lib/canvas_sync/job_batches/compat/sidekiq/web/batches_assets/css/styles.less +0 -182
- data/lib/canvas_sync/job_batches/compat/sidekiq/web/batches_assets/js/batch_tree.js +0 -108
- data/lib/canvas_sync/job_batches/compat/sidekiq/web/batches_assets/js/util.js +0 -2
- data/lib/canvas_sync/job_batches/compat/sidekiq/web/helpers.rb +0 -41
- data/lib/canvas_sync/job_batches/compat/sidekiq/web/views/_batch_tree.erb +0 -6
- data/lib/canvas_sync/job_batches/compat/sidekiq/web/views/_batches_table.erb +0 -44
- data/lib/canvas_sync/job_batches/compat/sidekiq/web/views/_common.erb +0 -13
- data/lib/canvas_sync/job_batches/compat/sidekiq/web/views/_jobs_table.erb +0 -21
- data/lib/canvas_sync/job_batches/compat/sidekiq/web/views/_pagination.erb +0 -26
- data/lib/canvas_sync/job_batches/compat/sidekiq/web/views/batch.erb +0 -81
- data/lib/canvas_sync/job_batches/compat/sidekiq/web/views/batches.erb +0 -23
- data/lib/canvas_sync/job_batches/compat/sidekiq/web/views/pool.erb +0 -137
- data/lib/canvas_sync/job_batches/compat/sidekiq/web/views/pools.erb +0 -47
- data/lib/canvas_sync/job_batches/compat/sidekiq/web.rb +0 -218
- data/lib/canvas_sync/job_batches/compat/sidekiq.rb +0 -149
- data/lib/canvas_sync/job_batches/compat.rb +0 -20
- data/lib/canvas_sync/job_batches/context_hash.rb +0 -157
- data/lib/canvas_sync/job_batches/hier_batch_ids.lua +0 -25
- data/lib/canvas_sync/job_batches/jobs/base_job.rb +0 -5
- data/lib/canvas_sync/job_batches/jobs/concurrent_batch_job.rb +0 -20
- data/lib/canvas_sync/job_batches/jobs/managed_batch_job.rb +0 -175
- data/lib/canvas_sync/job_batches/jobs/serial_batch_job.rb +0 -20
- data/lib/canvas_sync/job_batches/pool.rb +0 -254
- data/lib/canvas_sync/job_batches/pool_refill.lua +0 -47
- data/lib/canvas_sync/job_batches/redis_model.rb +0 -67
- data/lib/canvas_sync/job_batches/redis_script.rb +0 -161
- data/lib/canvas_sync/job_batches/schedule_callback.lua +0 -14
- data/lib/canvas_sync/job_batches/status.rb +0 -89
- data/lib/canvas_sync/job_uniqueness/compat/active_job.rb +0 -75
- data/lib/canvas_sync/job_uniqueness/compat/sidekiq.rb +0 -135
- data/lib/canvas_sync/job_uniqueness/compat.rb +0 -20
- data/lib/canvas_sync/job_uniqueness/configuration.rb +0 -25
- data/lib/canvas_sync/job_uniqueness/job_uniqueness.rb +0 -47
- data/lib/canvas_sync/job_uniqueness/lock_context.rb +0 -199
- data/lib/canvas_sync/job_uniqueness/locksmith.rb +0 -92
- data/lib/canvas_sync/job_uniqueness/on_conflict/base.rb +0 -32
- data/lib/canvas_sync/job_uniqueness/on_conflict/log.rb +0 -13
- data/lib/canvas_sync/job_uniqueness/on_conflict/null_strategy.rb +0 -9
- data/lib/canvas_sync/job_uniqueness/on_conflict/raise.rb +0 -11
- data/lib/canvas_sync/job_uniqueness/on_conflict/reject.rb +0 -21
- data/lib/canvas_sync/job_uniqueness/on_conflict/reschedule.rb +0 -20
- data/lib/canvas_sync/job_uniqueness/on_conflict.rb +0 -62
- data/lib/canvas_sync/job_uniqueness/strategy/base.rb +0 -107
- data/lib/canvas_sync/job_uniqueness/strategy/until_and_while_executing.rb +0 -35
- data/lib/canvas_sync/job_uniqueness/strategy/until_executed.rb +0 -20
- data/lib/canvas_sync/job_uniqueness/strategy/until_executing.rb +0 -20
- data/lib/canvas_sync/job_uniqueness/strategy/until_expired.rb +0 -16
- data/lib/canvas_sync/job_uniqueness/strategy/while_executing.rb +0 -26
- data/lib/canvas_sync/job_uniqueness/strategy.rb +0 -27
- data/lib/canvas_sync/job_uniqueness/unique_job_common.rb +0 -79
- data/spec/dummy/README.rdoc +0 -1
- data/spec/dummy/Rakefile +0 -6
- data/spec/dummy/app/services/live_events/assignment_created_event.rb +0 -12
- data/spec/dummy/app/services/live_events/assignment_updated_event.rb +0 -12
- data/spec/dummy/app/services/live_events/base_event.rb +0 -52
- data/spec/dummy/app/services/live_events/course_created_event.rb +0 -12
- data/spec/dummy/app/services/live_events/course_section_created_event.rb +0 -12
- data/spec/dummy/app/services/live_events/course_section_updated_event.rb +0 -12
- data/spec/dummy/app/services/live_events/course_updated_event.rb +0 -12
- data/spec/dummy/app/services/live_events/enrollment_created_event.rb +0 -12
- data/spec/dummy/app/services/live_events/enrollment_updated_event.rb +0 -12
- data/spec/dummy/app/services/live_events/grade_changed_event.rb +0 -12
- data/spec/dummy/app/services/live_events/module_created_event.rb +0 -12
- data/spec/dummy/app/services/live_events/module_item_created_event.rb +0 -12
- data/spec/dummy/app/services/live_events/module_item_updated_event.rb +0 -12
- data/spec/dummy/app/services/live_events/module_updated_event.rb +0 -12
- data/spec/dummy/app/services/live_events/submission_created_event.rb +0 -12
- data/spec/dummy/app/services/live_events/submission_updated_event.rb +0 -12
- data/spec/dummy/app/services/live_events/syllabus_updated_event.rb +0 -12
- data/spec/dummy/app/services/live_events/user_created_event.rb +0 -12
- data/spec/dummy/app/services/live_events/user_updated_event.rb +0 -12
- data/spec/dummy/bin/rails +0 -4
- data/spec/dummy/config/application.rb +0 -39
- data/spec/dummy/config/boot.rb +0 -5
- data/spec/dummy/config/database.yml +0 -25
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -41
- data/spec/dummy/config/environments/test.rb +0 -44
- data/spec/dummy/config/initializers/assets.rb +0 -11
- data/spec/dummy/config/initializers/session_store.rb +0 -3
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/routes.rb +0 -3
- data/spec/dummy/config/secrets.yml +0 -22
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/db/schema.rb +0 -563
- data/spec/job_batching/batch_spec.rb +0 -531
- data/spec/job_batching/callback_spec.rb +0 -38
- data/spec/job_batching/compat/active_job_spec.rb +0 -107
- data/spec/job_batching/compat/sidekiq_spec.rb +0 -127
- data/spec/job_batching/context_hash_spec.rb +0 -54
- data/spec/job_batching/flow_spec.rb +0 -82
- data/spec/job_batching/integration/fail_then_succeed.rb +0 -42
- data/spec/job_batching/integration/integration.rb +0 -57
- data/spec/job_batching/integration/nested.rb +0 -88
- data/spec/job_batching/integration/simple.rb +0 -47
- data/spec/job_batching/integration/workflow.rb +0 -134
- data/spec/job_batching/integration_helper.rb +0 -50
- data/spec/job_batching/pool_spec.rb +0 -161
- data/spec/job_batching/status_spec.rb +0 -76
- data/spec/job_batching/support/base_job.rb +0 -14
- data/spec/job_batching/support/sample_callback.rb +0 -2
- data/spec/job_uniqueness/compat/active_job_spec.rb +0 -49
- data/spec/job_uniqueness/compat/sidekiq_spec.rb +0 -68
- data/spec/job_uniqueness/lock_context_spec.rb +0 -106
- data/spec/job_uniqueness/on_conflict/log_spec.rb +0 -11
- data/spec/job_uniqueness/on_conflict/raise_spec.rb +0 -10
- data/spec/job_uniqueness/on_conflict/reschedule_spec.rb +0 -63
- data/spec/job_uniqueness/on_conflict_spec.rb +0 -16
- data/spec/job_uniqueness/spec_helper.rb +0 -17
- data/spec/job_uniqueness/strategy/base_spec.rb +0 -100
- data/spec/job_uniqueness/strategy/until_and_while_executing_spec.rb +0 -48
- data/spec/job_uniqueness/strategy/until_executed_spec.rb +0 -23
- data/spec/job_uniqueness/strategy/until_executing_spec.rb +0 -23
- data/spec/job_uniqueness/strategy/until_expired_spec.rb +0 -23
- data/spec/job_uniqueness/strategy/while_executing_spec.rb +0 -33
- data/spec/job_uniqueness/support/lock_strategy.rb +0 -28
- data/spec/job_uniqueness/support/on_conflict.rb +0 -24
- data/spec/job_uniqueness/support/test_worker.rb +0 -19
- data/spec/job_uniqueness/unique_job_common_spec.rb +0 -45
- /data/spec/{dummy → internal}/app/models/account.rb +0 -0
- /data/spec/{dummy → internal}/app/models/admin.rb +0 -0
- /data/spec/{dummy → internal}/app/models/assignment.rb +0 -0
- /data/spec/{dummy → internal}/app/models/assignment_group.rb +0 -0
- /data/spec/{dummy → internal}/app/models/assignment_override.rb +0 -0
- /data/spec/{dummy → internal}/app/models/context_module.rb +0 -0
- /data/spec/{dummy → internal}/app/models/context_module_item.rb +0 -0
- /data/spec/{dummy → internal}/app/models/course_progress.rb +0 -0
- /data/spec/{dummy → internal}/app/models/enrollment.rb +0 -0
- /data/spec/{dummy → internal}/app/models/grading_period.rb +0 -0
- /data/spec/{dummy → internal}/app/models/grading_period_group.rb +0 -0
- /data/spec/{dummy → internal}/app/models/group.rb +0 -0
- /data/spec/{dummy → internal}/app/models/group_membership.rb +0 -0
- /data/spec/{dummy → internal}/app/models/learning_outcome_result.rb +0 -0
- /data/spec/{dummy → internal}/app/models/pseudonym.rb +0 -0
- /data/spec/{dummy → internal}/app/models/role.rb +0 -0
- /data/spec/{dummy → internal}/app/models/rubric.rb +0 -0
- /data/spec/{dummy → internal}/app/models/rubric_assessment.rb +0 -0
- /data/spec/{dummy → internal}/app/models/rubric_association.rb +0 -0
- /data/spec/{dummy → internal}/app/models/score.rb +0 -0
- /data/spec/{dummy → internal}/app/models/section.rb +0 -0
- /data/spec/{dummy → internal}/app/models/submission.rb +0 -0
- /data/spec/{dummy → internal}/app/models/term.rb +0 -0
- /data/spec/{dummy → internal}/app/models/user.rb +0 -0
- /data/spec/{dummy → internal}/app/models/user_observer.rb +0 -0
- /data/spec/{dummy/db/migrate/20190702203621_create_courses.rb → internal/db/migrate/20250912205138_create_courses.rb} +0 -0
- /data/spec/{dummy/db/migrate/20190702203624_create_enrollments.rb → internal/db/migrate/20250912205143_create_enrollments.rb} +0 -0
- /data/spec/{dummy/db/migrate/20250319194134_create_course_nicknames.rb → internal/db/migrate/20250912205158_create_course_nicknames.rb} +0 -0
- /data/spec/{dummy/db/migrate/20250319194135_create_rubrics.rb → internal/db/migrate/20250912205159_create_rubrics.rb} +0 -0
- /data/spec/{dummy/db/migrate/20241223080202_create_assignment_overrides.rb → internal/db/migrate/20250912205163_create_assignment_overrides.rb} +0 -0
- /data/spec/{dummy/db/migrate/20250626194330_create_scores.rb → internal/db/migrate/20250912205164_create_scores.rb} +0 -0
@@ -1,27 +0,0 @@
|
|
1
|
-
module CanvasSync::JobUniqueness
|
2
|
-
module Strategy
|
3
|
-
extend ActiveSupport::Autoload
|
4
|
-
|
5
|
-
autoload :Base
|
6
|
-
|
7
|
-
autoload :UntilExpired
|
8
|
-
autoload :UntilExecuted
|
9
|
-
autoload :UntilExecuting
|
10
|
-
autoload :UntilAndWhileExecuting
|
11
|
-
autoload :WhileExecuting
|
12
|
-
|
13
|
-
class << self
|
14
|
-
def lookup(strategy)
|
15
|
-
matching_strategy(strategy.to_s.camelize) ||
|
16
|
-
CanvasSync::JobUniqueness.config.lock_strategies[strategy] ||
|
17
|
-
raise(ArgumentError, "strategy: #{strategy} is not found. Is it declared in the configuration?")
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def matching_strategy(const)
|
23
|
-
const_get(const, false) if const_defined?(const, false)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,79 +0,0 @@
|
|
1
|
-
|
2
|
-
module CanvasSync::JobUniqueness
|
3
|
-
module UniqueJobCommon
|
4
|
-
extend ActiveSupport::Concern
|
5
|
-
|
6
|
-
included do
|
7
|
-
class_attribute :unique_job_options, instance_writer: false
|
8
|
-
end
|
9
|
-
|
10
|
-
class_methods do
|
11
|
-
# ensure_uniqueness(
|
12
|
-
# strategy: :until_executed, # :until_executed, :until_executing, :until_expired, :until_and_while_executing, :while_executing
|
13
|
-
# on_conflict: :raise, # :raise, :log, :reject, :reschedule, { enqueue: ..., perform: ... }, proc
|
14
|
-
# lock_ttl: 7.days, # seconds
|
15
|
-
# lock_timeout: 0, # seconds
|
16
|
-
|
17
|
-
# scope: :per_queue, # :global, :per_queue, string ("<class>-<queue>"), proc
|
18
|
-
# hash: ->{ { ... } },
|
19
|
-
|
20
|
-
# # In the case of UntilExecuted and WhileExecuting, how should the execution lock be released in an error condition?
|
21
|
-
# # :any - Release the lock when the Job's (implicit) Batch is :complete
|
22
|
-
# # :death - Release the lock when the Job's Batch receives the :death callback
|
23
|
-
# # :stagnant - Release the lock when the Job's Batch receives the :stagnant callback
|
24
|
-
# # :expire - Do not release the lock until it expires
|
25
|
-
# unlock_on_failure: :stagnant,
|
26
|
-
# )
|
27
|
-
def ensure_uniqueness(**kwargs)
|
28
|
-
if self.unique_job_options.present?
|
29
|
-
raise ArgumentError, "ensure_uniqueness can only be called once per job class"
|
30
|
-
end
|
31
|
-
|
32
|
-
begin
|
33
|
-
require "sidekiq_unique_jobs"
|
34
|
-
rescue LoadError
|
35
|
-
raise LoadError, "sidekiq-unique-jobs is required for ensure_uniqueness"
|
36
|
-
end
|
37
|
-
|
38
|
-
OnConflict.validate!(kwargs[:on_conflict], kwargs[:strategy]) if kwargs[:on_conflict].present?
|
39
|
-
|
40
|
-
kwargs[:scope] ||= :per_queue
|
41
|
-
kwargs[:ttl] ||= 30.days.to_i
|
42
|
-
kwargs[:timeout] ||= 0
|
43
|
-
kwargs[:limit] ||= 1
|
44
|
-
|
45
|
-
self.unique_job_options = kwargs
|
46
|
-
|
47
|
-
include UniqueJobMethods
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
module UniqueJobMethods
|
52
|
-
extend ActiveSupport::Concern
|
53
|
-
|
54
|
-
class_methods do
|
55
|
-
def unlock!(jid = nil, args: nil, kwargs: nil, queue: nil)
|
56
|
-
queue = self.try(:default_queue_name) || try(:queue)
|
57
|
-
raise ArgumentError, "Must specify queue:" unless queue.is_a?(String) || queue.is_a?(Symbol)
|
58
|
-
|
59
|
-
temp_context = LockContext.new({ job_clazz: self, jid: jid, queue: queue, args: args, kwargs: kwargs })
|
60
|
-
strategy = temp_context.lock_strategy
|
61
|
-
locksmith = strategy.send(:locksmith)
|
62
|
-
|
63
|
-
if jid
|
64
|
-
locksmith.unlock!()
|
65
|
-
else
|
66
|
-
locksmith.locked_jids.each do |jid|
|
67
|
-
unlock!(jid, args: args, kwargs: kwargs, queue: queue)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
# def unlock_all!(queue: :all)
|
73
|
-
# # TODO Public API to manually remove all locks for this class
|
74
|
-
# end
|
75
|
-
end
|
76
|
-
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
data/spec/dummy/README.rdoc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Dummy Rails App for gem testing
|
data/spec/dummy/Rakefile
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
# #
|
2
|
-
# AUTO GENERATED LIVE EVENT
|
3
|
-
# This was auto generated by the CanvasSync Gem.
|
4
|
-
# You can customize it as needed, but make sure you test
|
5
|
-
# any changes you make to the auto generated methods.
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
module LiveEvents
|
10
|
-
class AssignmentCreatedEvent < LiveEvents::AssignmentEvent
|
11
|
-
end
|
12
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# #
|
2
|
-
# AUTO GENERATED LIVE EVENT
|
3
|
-
# This was auto generated by the CanvasSync Gem.
|
4
|
-
# You can customize it as needed, but make sure you test
|
5
|
-
# any changes you make to the auto generated methods.
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
module LiveEvents
|
10
|
-
class AssignmentUpdatedEvent < LiveEvents::AssignmentEvent
|
11
|
-
end
|
12
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# #
|
2
|
-
# AUTO GENERATED LIVE EVENT
|
3
|
-
# This was auto generated by the CanvasSync Gem.
|
4
|
-
# You can customize it as needed, but make sure you test
|
5
|
-
# any changes you make to the auto generated methods.
|
6
|
-
#
|
7
|
-
# LiveEvent message formats can be found at https://canvas.instructure.com/doc/api/file.live_events.html
|
8
|
-
# In the general case, LiveEvent message content should not be trusted - it is highly possible that events may
|
9
|
-
# arrive out of order. Most of the CanvasSync LiveEvent templates solve this by always fetching the object from the API.
|
10
|
-
#
|
11
|
-
|
12
|
-
|
13
|
-
module LiveEvents
|
14
|
-
class RetryLiveEventJob < StandardError; end
|
15
|
-
|
16
|
-
class BaseEvent < CanvasSync::Job
|
17
|
-
attr_accessor :raw_payload
|
18
|
-
attr_accessor :payload
|
19
|
-
attr_accessor :metadata
|
20
|
-
|
21
|
-
def perform(event_payload)
|
22
|
-
@raw_payload = event_payload
|
23
|
-
@metadata = HashWithIndifferentAccess.new(event_payload["attributes"])
|
24
|
-
@payload = HashWithIndifferentAccess.new(event_payload["body"])
|
25
|
-
process_with_retry
|
26
|
-
end
|
27
|
-
|
28
|
-
def process
|
29
|
-
raise "process must be implemented in your subclass"
|
30
|
-
end
|
31
|
-
|
32
|
-
# Live events will use a canvas global ID (cross shard) for any ID's provided. This method will return the local ID.
|
33
|
-
def local_canvas_id(id)
|
34
|
-
id.to_i % 10_000_000_000_000
|
35
|
-
end
|
36
|
-
|
37
|
-
private
|
38
|
-
|
39
|
-
# Sometimes a creation and update event get sent by Canvas at almost the exact same time. This means
|
40
|
-
# that there is sometimes a race condition that causes them to both try to save a new record at the same time.
|
41
|
-
# If that happens, just wait a few seconds and try again -- the second try should be able to see that
|
42
|
-
# the save already occured, and it will just update the row..
|
43
|
-
def process_with_retry
|
44
|
-
tries ||= 5
|
45
|
-
process
|
46
|
-
rescue ActiveRecord::RecordNotUnique, ActiveRecord::RecordInvalid, RetryLiveEventJob => e
|
47
|
-
raise e if (tries -= 1).zero?
|
48
|
-
sleep 5
|
49
|
-
retry
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# #
|
2
|
-
# AUTO GENERATED LIVE EVENT
|
3
|
-
# This was auto generated by the CanvasSync Gem.
|
4
|
-
# You can customize it as needed, but make sure you test
|
5
|
-
# any changes you make to the auto generated methods.
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
module LiveEvents
|
10
|
-
class CourseCreatedEvent < LiveEvents::CourseEvent
|
11
|
-
end
|
12
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# #
|
2
|
-
# AUTO GENERATED LIVE EVENT
|
3
|
-
# This was auto generated by the CanvasSync Gem.
|
4
|
-
# You can customize it as needed, but make sure you test
|
5
|
-
# any changes you make to the auto generated methods.
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
module LiveEvents
|
10
|
-
class CourseSectionCreatedEvent < LiveEvents::CourseSectionEvent
|
11
|
-
end
|
12
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# #
|
2
|
-
# AUTO GENERATED LIVE EVENT
|
3
|
-
# This was auto generated by the CanvasSync Gem.
|
4
|
-
# You can customize it as needed, but make sure you test
|
5
|
-
# any changes you make to the auto generated methods.
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
module LiveEvents
|
10
|
-
class CourseSectionUpdatedEvent < LiveEvents::CourseSectionEvent
|
11
|
-
end
|
12
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# #
|
2
|
-
# AUTO GENERATED LIVE EVENT
|
3
|
-
# This was auto generated by the CanvasSync Gem.
|
4
|
-
# You can customize it as needed, but make sure you test
|
5
|
-
# any changes you make to the auto generated methods.
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
module LiveEvents
|
10
|
-
class CourseUpdatedEvent < LiveEvents::CourseEvent
|
11
|
-
end
|
12
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# #
|
2
|
-
# AUTO GENERATED LIVE EVENT
|
3
|
-
# This was auto generated by the CanvasSync Gem.
|
4
|
-
# You can customize it as needed, but make sure you test
|
5
|
-
# any changes you make to the auto generated methods.
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
module LiveEvents
|
10
|
-
class EnrollmentCreatedEvent < LiveEvents::EnrollmentEvent
|
11
|
-
end
|
12
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# #
|
2
|
-
# AUTO GENERATED LIVE EVENT
|
3
|
-
# This was auto generated by the CanvasSync Gem.
|
4
|
-
# You can customize it as needed, but make sure you test
|
5
|
-
# any changes you make to the auto generated methods.
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
module LiveEvents
|
10
|
-
class EnrollmentUpdatedEvent < LiveEvents::EnrollmentEvent
|
11
|
-
end
|
12
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# #
|
2
|
-
# AUTO GENERATED LIVE EVENT
|
3
|
-
# This was auto generated by the CanvasSync Gem.
|
4
|
-
# You can customize it as needed, but make sure you test
|
5
|
-
# any changes you make to the auto generated methods.
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
module LiveEvents
|
10
|
-
class GradeChangedEvent < LiveEvents::GradeEvent
|
11
|
-
end
|
12
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# #
|
2
|
-
# AUTO GENERATED LIVE EVENT
|
3
|
-
# This was auto generated by the CanvasSync Gem.
|
4
|
-
# You can customize it as needed, but make sure you test
|
5
|
-
# any changes you make to the auto generated methods.
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
module LiveEvents
|
10
|
-
class ModuleCreatedEvent < LiveEvents::ModuleEvent
|
11
|
-
end
|
12
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# #
|
2
|
-
# AUTO GENERATED LIVE EVENT
|
3
|
-
# This was auto generated by the CanvasSync Gem.
|
4
|
-
# You can customize it as needed, but make sure you test
|
5
|
-
# any changes you make to the auto generated methods.
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
module LiveEvents
|
10
|
-
class ModuleItemCreatedEvent < LiveEvents::ModuleItemEvent
|
11
|
-
end
|
12
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# #
|
2
|
-
# AUTO GENERATED LIVE EVENT
|
3
|
-
# This was auto generated by the CanvasSync Gem.
|
4
|
-
# You can customize it as needed, but make sure you test
|
5
|
-
# any changes you make to the auto generated methods.
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
module LiveEvents
|
10
|
-
class ModuleItemUpdatedEvent < LiveEvents::ModuleItemEvent
|
11
|
-
end
|
12
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# #
|
2
|
-
# AUTO GENERATED LIVE EVENT
|
3
|
-
# This was auto generated by the CanvasSync Gem.
|
4
|
-
# You can customize it as needed, but make sure you test
|
5
|
-
# any changes you make to the auto generated methods.
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
module LiveEvents
|
10
|
-
class ModuleUpdatedEvent < LiveEvents::ModuleEvent
|
11
|
-
end
|
12
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# #
|
2
|
-
# AUTO GENERATED LIVE EVENT
|
3
|
-
# This was auto generated by the CanvasSync Gem.
|
4
|
-
# You can customize it as needed, but make sure you test
|
5
|
-
# any changes you make to the auto generated methods.
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
module LiveEvents
|
10
|
-
class SubmissionCreatedEvent < LiveEvents::SubmissionEvent
|
11
|
-
end
|
12
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# #
|
2
|
-
# AUTO GENERATED LIVE EVENT
|
3
|
-
# This was auto generated by the CanvasSync Gem.
|
4
|
-
# You can customize it as needed, but make sure you test
|
5
|
-
# any changes you make to the auto generated methods.
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
module LiveEvents
|
10
|
-
class SubmissionUpdatedEvent < LiveEvents::SubmissionEvent
|
11
|
-
end
|
12
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# #
|
2
|
-
# AUTO GENERATED LIVE EVENT
|
3
|
-
# This was auto generated by the CanvasSync Gem.
|
4
|
-
# You can customize it as needed, but make sure you test
|
5
|
-
# any changes you make to the auto generated methods.
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
module LiveEvents
|
10
|
-
class SyllabusUpdatedEvent < LiveEvents::SyllabusEvent
|
11
|
-
end
|
12
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# #
|
2
|
-
# AUTO GENERATED LIVE EVENT
|
3
|
-
# This was auto generated by the CanvasSync Gem.
|
4
|
-
# You can customize it as needed, but make sure you test
|
5
|
-
# any changes you make to the auto generated methods.
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
module LiveEvents
|
10
|
-
class UserCreatedEvent < LiveEvents::UserEvent
|
11
|
-
end
|
12
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# #
|
2
|
-
# AUTO GENERATED LIVE EVENT
|
3
|
-
# This was auto generated by the CanvasSync Gem.
|
4
|
-
# You can customize it as needed, but make sure you test
|
5
|
-
# any changes you make to the auto generated methods.
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
module LiveEvents
|
10
|
-
class UserUpdatedEvent < LiveEvents::UserEvent
|
11
|
-
end
|
12
|
-
end
|
data/spec/dummy/bin/rails
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require File.expand_path('../boot', __FILE__)
|
2
|
-
|
3
|
-
require 'logger'
|
4
|
-
|
5
|
-
require 'rails'
|
6
|
-
require 'active_record/railtie'
|
7
|
-
# require 'active_storage/engine'
|
8
|
-
require 'action_controller/railtie'
|
9
|
-
require 'action_view/railtie'
|
10
|
-
require 'action_mailer/railtie'
|
11
|
-
require 'active_job/railtie'
|
12
|
-
# require 'action_cable/engine'
|
13
|
-
# require 'action_mailbox/engine'
|
14
|
-
# require 'action_text/engine'
|
15
|
-
require 'rails/test_unit/railtie'
|
16
|
-
# require 'sprockets/railtie'
|
17
|
-
|
18
|
-
Bundler.require(*Rails.groups)
|
19
|
-
require "canvas_sync"
|
20
|
-
|
21
|
-
module Dummy
|
22
|
-
class Application < Rails::Application
|
23
|
-
# Settings in config/environments/* take precedence over those specified here.
|
24
|
-
# Application configuration should go into files in config/initializers
|
25
|
-
# -- all .rb files in that directory are automatically loaded.
|
26
|
-
|
27
|
-
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
28
|
-
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
29
|
-
# config.time_zone = 'Central Time (US & Canada)'
|
30
|
-
|
31
|
-
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
32
|
-
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
33
|
-
# config.i18n.default_locale = :de
|
34
|
-
|
35
|
-
# Do not swallow errors in after_commit/after_rollback callbacks.
|
36
|
-
# config.active_record.raise_in_transactional_callbacks = true
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
data/spec/dummy/config/boot.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
|
2
|
-
default: &default
|
3
|
-
adapter: postgresql
|
4
|
-
encoding: unicode
|
5
|
-
# For details on connection pooling, see Rails configuration guide
|
6
|
-
# http://guides.rubyonrails.org/configuring.html#database-pooling
|
7
|
-
pool: <%= ENV.fetch("DB_POOL_SIZE", nil) || (ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i + 10) %>
|
8
|
-
username: <%= ENV.fetch("DB_USERNAME", "") %>
|
9
|
-
password: <%= ENV.fetch("DB_PASSWORD", "") %>
|
10
|
-
host: <%= ENV.fetch("DB_ADDRESS", "localhost") %>
|
11
|
-
|
12
|
-
development:
|
13
|
-
<<: *default
|
14
|
-
database: canvas_sync_development
|
15
|
-
|
16
|
-
test:
|
17
|
-
<<: *default
|
18
|
-
database: canvas_sync_test
|
19
|
-
|
20
|
-
production:
|
21
|
-
<<: *default
|
22
|
-
host: <%= ENV.fetch('DB_ADDRESS', 'localhost') %>
|
23
|
-
database: canvas_sync_production
|
24
|
-
username: <%= ENV.fetch("DB_USERNAME", "canvas_sync_specs_postgres_user") %>
|
25
|
-
password: <%= ENV.fetch("DB_PASSWORD", 'canvas_sync_specs_postgres_password') %>
|
@@ -1,41 +0,0 @@
|
|
1
|
-
Rails.application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
-
|
4
|
-
# In the development environment your application's code is reloaded on
|
5
|
-
# every request. This slows down response time but is perfect for development
|
6
|
-
# since you don't have to restart the web server when you make code changes.
|
7
|
-
config.cache_classes = false
|
8
|
-
|
9
|
-
# Do not eager load code on boot.
|
10
|
-
config.eager_load = false
|
11
|
-
|
12
|
-
# Show full error reports and disable caching.
|
13
|
-
config.consider_all_requests_local = true
|
14
|
-
config.action_controller.perform_caching = false
|
15
|
-
|
16
|
-
# Don't care if the mailer can't send.
|
17
|
-
config.action_mailer.raise_delivery_errors = false
|
18
|
-
|
19
|
-
# Print deprecation notices to the Rails logger.
|
20
|
-
config.active_support.deprecation = :log
|
21
|
-
|
22
|
-
# Raise an error on page load if there are pending migrations.
|
23
|
-
config.active_record.migration_error = :page_load
|
24
|
-
|
25
|
-
# Debug mode disables concatenation and preprocessing of assets.
|
26
|
-
# This option may cause significant delays in view rendering with a large
|
27
|
-
# number of complex assets.
|
28
|
-
# config.assets.debug = true
|
29
|
-
|
30
|
-
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
31
|
-
# yet still be able to expire them through the digest params.
|
32
|
-
# config.assets.digest = true
|
33
|
-
|
34
|
-
# Adds additional error checking when serving assets at runtime.
|
35
|
-
# Checks for improperly declared sprockets dependencies.
|
36
|
-
# Raises helpful error messages.
|
37
|
-
# config.assets.raise_runtime_errors = true
|
38
|
-
|
39
|
-
# Raises error for missing translations
|
40
|
-
# config.action_view.raise_on_missing_translations = true
|
41
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
Rails.application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
-
|
4
|
-
# The test environment is used exclusively to run your application's
|
5
|
-
# test suite. You never need to work with it otherwise. Remember that
|
6
|
-
# your test database is "scratch space" for the test suite and is wiped
|
7
|
-
# and recreated between test runs. Don't rely on the data there!
|
8
|
-
config.cache_classes = false
|
9
|
-
|
10
|
-
# Do not eager load code on boot. This avoids loading your whole application
|
11
|
-
# just for the purpose of running a single test. If you are using a tool that
|
12
|
-
# preloads Rails for running tests, you may have to set it to true.
|
13
|
-
config.eager_load = false
|
14
|
-
|
15
|
-
# Configure static file server for tests with Cache-Control for performance.
|
16
|
-
config.serve_static_files = true
|
17
|
-
config.static_cache_control = 'public, max-age=3600'
|
18
|
-
|
19
|
-
# Show full error reports and disable caching.
|
20
|
-
config.consider_all_requests_local = true
|
21
|
-
config.action_controller.perform_caching = false
|
22
|
-
|
23
|
-
# Raise exceptions instead of rendering exception templates.
|
24
|
-
config.action_dispatch.show_exceptions = false
|
25
|
-
|
26
|
-
# Disable request forgery protection in test environment.
|
27
|
-
config.action_controller.allow_forgery_protection = false
|
28
|
-
|
29
|
-
# Tell Action Mailer not to deliver emails to the real world.
|
30
|
-
# The :test delivery method accumulates sent emails in the
|
31
|
-
# ActionMailer::Base.deliveries array.
|
32
|
-
config.action_mailer.delivery_method = :test
|
33
|
-
|
34
|
-
# Randomize the order test cases are executed.
|
35
|
-
config.active_support.test_order = :random
|
36
|
-
|
37
|
-
# Print deprecation notices to the stderr.
|
38
|
-
config.active_support.deprecation = :stderr
|
39
|
-
|
40
|
-
config.active_job.queue_adapter = :test
|
41
|
-
|
42
|
-
# Raises error for missing translations
|
43
|
-
# config.action_view.raise_on_missing_translations = true
|
44
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Version of your assets, change this if you want to expire all your assets.
|
4
|
-
# Rails.application.config.assets.version = '1.0'
|
5
|
-
|
6
|
-
# Add additional assets to the asset load path
|
7
|
-
# Rails.application.config.assets.paths << Emoji.images_path
|
8
|
-
|
9
|
-
# Precompile additional assets.
|
10
|
-
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
11
|
-
# Rails.application.config.assets.precompile += %w( search.js )
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
-
# is enabled by default.
|
5
|
-
|
6
|
-
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
-
ActiveSupport.on_load(:action_controller) do
|
8
|
-
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
9
|
-
end
|
10
|
-
|
11
|
-
# To enable root element in JSON for ActiveRecord objects.
|
12
|
-
# ActiveSupport.on_load(:active_record) do
|
13
|
-
# self.include_root_in_json = true
|
14
|
-
# end
|
data/spec/dummy/config/routes.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
-
# If you change this key, all old signed cookies will become invalid!
|
5
|
-
|
6
|
-
# Make sure the secret is at least 30 characters and all random,
|
7
|
-
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
-
# You can use `rake secret` to generate a secure secret key.
|
9
|
-
|
10
|
-
# Make sure the secrets in this file are kept private
|
11
|
-
# if you're sharing your code publicly.
|
12
|
-
|
13
|
-
development:
|
14
|
-
secret_key_base: 4fc03e27b5bfc390d7beaf99e739c1a9ad4264d58cd2a1db40fbb83b6ed320e1fa77fb4e0dd7c24816811170a59d65b623bc887b4ca1e0bd0c57348e9e304f73
|
15
|
-
|
16
|
-
test:
|
17
|
-
secret_key_base: 7700238de042256ef63c58a57c6bf431b6ebca79f95f66ccd04b5ad8b89761db15a9b89a85b08ace8a69ae3867462cb9514eb21d0e591d8f3881de79d7b72675
|
18
|
-
|
19
|
-
# Do not keep production secrets in the repository,
|
20
|
-
# instead read values from the environment.
|
21
|
-
production:
|
22
|
-
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
data/spec/dummy/config.ru
DELETED