Skip to content

Resolve "No mail notification sent for group & project access request"

What does this MR do and why?

Related to #262052 (closed)

Problem

On investigation, we figured out that the emails were not being sent out due to a classic Sidekiq gotcha:

  • Sidekiq jobs are enqueued within a callback that is NOT after_commit (here, after_create).
  • This means that the job is enqueued even before the COMMIT in the database is completed.
  • On production, Sidekiq is fast and picks up this job instantly.
  • When the job is processed, COMMIT in the database is still not completed, and hence it is unable to fetch the Member record that was just created, and it returns from the execution silently.
  • Since no explicit errors are raised, there are no retries, it is not registered on Sentry and the job just vanishes.

Fix

We've changed the callback to a after_commit, on: [:create], so that the job is scheduled only after the COMMIT is completed.

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Manoj M J

Merge request reports