You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While we're using sidekiq-unique-jobs gem to add unique constraints to sidekiq jobs, and we currently set sidekiq_options lock: :until_executed in CourseDataUpdateWorker worker to avoid duplicate jobs (with the same arguments and job class), it's still possible to end up with duplicate articles_courses rows.
One possible scenario for this is when running a manual update course stats process through the manual_update route. As this update runs synchronously there is no guarantee that a queued UpdateCourseStats job will run simultaneously.
To Reproduce
Steps to reproduce the behavior:
As the problem is related to a race condition, it's not trivial to reproduce. However, this is one scenario that may show the problem:
Start the app locally.
Be sure sidekiq is up (bundle exec sidekiq start).
Download a course locally (you can do this through the "Copy course from another server" admin view).
Add the course to default campaign.
Run a manual update using the manual_update route (you need to be an admin for that).
If an update for that course was scheduled and run at the same time than your synchronous update, then duplicate articles_courses rows may be created.
Expected behavior
We should avoid having duplicate articles_courses rows (i.e., multiple rows with the same course_id and article_id). This can be prevented by adding a unique constraint on (course_id, article_id) in the articles_courses table. Proper tests should be done before migrating articles_courses table.
The text was updated successfully, but these errors were encountered:
@cr3ativ3cod3r this is probably not a great issue for a new contributor, as it will require some manual testing against a realistically-sized database in a production-like environment.
What is happening?
While we're using sidekiq-unique-jobs gem to add unique constraints to sidekiq jobs, and we currently set
sidekiq_options lock: :until_executed
inCourseDataUpdateWorker
worker to avoid duplicate jobs (with the same arguments and job class), it's still possible to end up with duplicatearticles_courses
rows.One possible scenario for this is when running a manual update course stats process through the
manual_update
route. As this update runs synchronously there is no guarantee that a queuedUpdateCourseStats
job will run simultaneously.To Reproduce
If an update for that course was scheduled and run at the same time than your synchronous update, then duplicate
articles_courses
rows may be created.Expected behavior
We should avoid having duplicate
articles_courses
rows (i.e., multiple rows with the samecourse_id
andarticle_id
). This can be prevented by adding a unique constraint on (course_id
,article_id
) in thearticles_courses
table. Proper tests should be done before migratingarticles_courses
table.The text was updated successfully, but these errors were encountered: