Ideally we would use READ COMMITTED transaction isolation level on MySQL as well which defaults to REPEATABLE READ. The other 2 supported databases already default to READ COMMITTED. REPEATABLE READ doesn't seem to enhance operation, rather it is slower and even might be harmful when having code like:
if object.value = check
object.another_value = something
end
Update: Use https://github.com/brianmario/mysql2#initial-command-on-connect-and-reconnect
– old info below –
We can monkey patch MySQL2 adapter, some ideas:
https://stackoverflow.com/a/34432139/520567
Or just hook to the `checkout` connection adapter hook, some ideas:
https://stackoverflow.com/a/57547710/520567
Or check what we have about transactions already in
https://github.com/3scale/porta/blob/master/app/lib/api_authentication/by_access_token.rb