CSC/ECE 517 Fall 2021 - E2144. Refactor delayed mailer and scheduled task

From Expertiza_Wiki
Revision as of 20:42, 17 October 2021 by Ajlandow (talk | contribs) (Add "Summary of Work Needed")
Jump to navigation Jump to search

Background

This project revolves around the Sidekiq gem for asynchronous processing of email tasks. It has a queue system to hold and then process jobs. Sidekiq’s queue replaces DelayedMailer’s queue. The previous team that worked on this also created a method perform() to gather email IDs of all participants in an assignment and send them an email reminder. Some test cases exist for this work.

Previous Setup

Initial work can be found here.

Code in the pull request was found to be reasonable and working. The method perform() has:

Metrics for perform method
Metric Current Value Limit
Cognitive Complexity 15 5
Cyclomatic Complexity 8 6
Assignment Branch Condition size 22.93 15
Perceived complexity 10 7

Previous pull request also has duplicated commit messages and the commits need to be squashed.

Files involved (some changed should not have been changed):

  • app/controllers/assignments_controller.rb
  • app/mailers/mail_worker.rb
  • app/models/assignment_form.rb
  • config/sidekiq.yml
  • spec/models/assignment_form_spec.rb
  • spec/sidekiq_mail_worker_spec.rb
  • spec/spec_helper.rb

There are minor styling issues such as missing or trailing whitespaces, lines that are too long, extra empty line, unused arguments.

Summary of Work Needed

After discussing with our project mentor and Dr. Gehringer, we determined the main tasks to be the following: 1. Refactor the single Sidekiq worker into multiple workers. 2. Remove all code related to the `drop_one_member_topics` deadline type. 3. Update and add unit tests according to the above changes. 4. Test all new worker classes to ensure Sidekiq jobs were being dequeued and run as expected