Skip to content

CV2-6172: Prevent duplicate Sidekiq jobs#2435

Merged
melsawy merged 6 commits into
developfrom
CV2-6172-prevent-duplicate-sidekiq-jobs
Jun 16, 2026
Merged

CV2-6172: Prevent duplicate Sidekiq jobs#2435
melsawy merged 6 commits into
developfrom
CV2-6172-prevent-duplicate-sidekiq-jobs

Conversation

@melsawy

@melsawy melsawy commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Description

Added a new argument to ElasticSearchWorker enqueued_at so I can skip job execution if the job is outdated.

References: CV2-6172

How to test?

Added unit test

Checklist

  • I have performed a self-review of my code and ensured that it is safe and runnable, that code coverage has not decreased, and that there are no new Code Climate issues. I have also followed Meedan's internal coding guidelines.

@@ -15,7 +15,6 @@ def perform(model_data, options, type)
ops = {
'create_doc' => 'create_elasticsearch_doc_bg',
'update_doc' => 'update_elasticsearch_doc_bg',
'update_doc_team' => 'update_elasticsearch_doc_team_bg',

@melsawy melsawy Jun 14, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found that this callback has already been removed from the code, so there's no need to include it in the list.

@melsawy melsawy marked this pull request as ready for review June 14, 2026 17:31
@melsawy melsawy requested a review from caiosba June 14, 2026 17:31

@caiosba caiosba left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving, assuming this only applies when all fields are updated, not just a single field, right? That’s how I understood it. Otherwise, it could miss some field updates and only apply the latest ones. Please confirm, @melsawy.

@melsawy

melsawy commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

Approving, assuming this only applies when all fields are updated, not just a single field, right? That’s how I understood it. Otherwise, it could miss some field updates and only apply the latest ones. Please confirm, @melsawy.

This applies when single or some fields update but the model not ProjectMedia
for example update status, tasks or reports fields as in this case I check against the Annotation.updated_at field not the ProjectMedia.updated_at as the ProjectMedia object can update different fields so I avoid checking ProjectMedia.update_at

@jonymaster jonymaster force-pushed the CV2-6172-prevent-duplicate-sidekiq-jobs branch from 6b081f1 to d407090 Compare June 15, 2026 17:10
@melsawy melsawy merged commit 2378613 into develop Jun 16, 2026
@melsawy melsawy deleted the CV2-6172-prevent-duplicate-sidekiq-jobs branch June 16, 2026 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants