Skip to content

Implement Concurrency Safety for Reservation Creation #13

Description

@Ferdus615

Prevent the same user from reserving the same book multiple times when concurrent requests hit the server at the exact same time.

Acceptance Criteria:

Implement service-level validation that checks for active reservations (not just unique constraint)

Use database-level locking or optimistic locking for reservation creation

Ensure atomic check-and-create operation for reservations

Handle concurrent reservation attempts gracefully

Technical Notes:
Since we're keeping historical reservations (EXPIRED/COMPLETED) in the table, we cannot rely solely on @UniqueConstraint. We need to check for active statuses (PENDING, READY_FOR_PICKUP) in the service layer with proper concurrency control.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions