When a user is created, Authlogic sets a persistence token which it uses for session maintenance. As part of this process, it does a query like:
User Exists (517.6ms) SELECT 1 AS one FROM 'users' WHERE 'users'.'persistence_token' = BINARY 'xyz123123' AND 'users'.'deleted_at' IS NULL LIMIT 1
which as you can see is pretty expensive on our database. This code is evidenced here: https://github.com/binarylogic/authlogic/blob/4f03d6520d8b13394023f5cbc9ba74ab1464b89d/lib/authlogic/session/session.rb This is particularly problematic with our user sync function which creates thousands of users and thus this query is very very expensive.
How can we disable this behavior during this operation and set it later? I tried to use user.save_without_session_maintenance but that didn’t seem to work for me.