Members invitations scheduled before commit
Summary
Member invitation emails raising exceptions in sidekiq jobs due to records not being committed yet.
What is the current bug behavior?
ActiveRecord::RecordNotFound: Couldn't find Member with 'id'=1234
Possible fixes
Run notification in run_after_commit
block.
def send_invite
run_after_commit { notification_service.invite_group_member(self, @raw_invite_token) }
super
end
Looks like it impacts both project/group members.
Similar Issue/Commit for SSH Keys
Internal ZD: https://gitlab.zendesk.com/agent/tickets/94484
Edited by Davin Walker