When logging into an existing account from a guest account on a multi-thread server (like Puma) devise-guests enters a race condition where some threads believe the guest user exists and some threads believe the guest user has been deleted and then tries to create it again. This leads to an effectively meaningless error that the guest user's email is already taken in the database as the non-guest account is logged in. This solution adds a dependency for with_advisory_lock but it prevents the unnecessary error.
We should probably also make sure this doesn't "undelete" deleted guest account on successful login.
When logging into an existing account from a guest account on a multi-thread server (like Puma)
devise-guests
enters a race condition where some threads believe the guest user exists and some threads believe the guest user has been deleted and then tries to create it again. This leads to an effectively meaningless error that the guest user's email is already taken in the database as the non-guest account is logged in. This solution adds a dependency forwith_advisory_lock
but it prevents the unnecessary error.We should probably also make sure this doesn't "undelete" deleted guest account on successful login.