Skip to content

Prevent race during school creation per creator - #972

Draft
cocomarine wants to merge 3 commits into
mainfrom
1612-fix-race-when-creating-schools
Draft

Prevent race during school creation per creator#972
cocomarine wants to merge 3 commits into
mainfrom
1612-fix-race-when-creating-schools

Conversation

@cocomarine

Copy link
Copy Markdown
Contributor

Status

Points for consideration:

  • Security
  • Performance

What's changed?

Description of what's been done - bullets are often best

@cla-bot cla-bot Bot added the cla-signed label Aug 18, 2026
@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown

Test coverage

92.3% line coverage reported by SimpleCov.
Run: https://github.com/RaspberryPiFoundation/editor-api/actions/runs/32159452677

rescue ActiveRecord::RecordInvalid => e
# A double submit loses the advisory lock race and fails the creator_id
# uniqueness validation as expected, so keep it out of Sentry.
Sentry.capture_exception(e) unless response[:school].errors.of_kind?(:creator_id, :taken)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant