WIP: Introduce Gitlab::Database::ConnectionPool
This is a class where we could use in the migration, creating a database connection pool with arbitrary pool size. In general, the only use case would be:
Gitlab::Database::ConnectionPool.with_pool(2) do |pool|
pool.execute_async('DELETE FROM table0;')
pool.execute_async('DELETE FROM table1;')
pool.execute_async('DELETE FROM table2;')
end
This would run the queries with ActiveRecord's with_connection
and
connection.execute
in threads, and wait until all the queries are
done, and finally gracefully close the connection pool.
@yorickpeterse Please review, thank you!
/cc @ayufan