diff options
author | Stan Hu <stanhu@gmail.com> | 2017-01-11 20:38:30 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-01-11 20:47:53 +0300 |
commit | 1e17096f5fb1c107f5a850dd5f64c89ced6c13fb (patch) | |
tree | b12b93a241b0ef9930ffa9fde54d4dcd5362f21e /doc/development/testing_guide/testing_levels.md | |
parent | 1ff2dfa1cc6ba125ed53d42443713dcbda3f57f6 (diff) |
Memoize `get_all_versions` to reduce number of DB queries in testssh-speed-up-get-all-versions-test
Every time we access `ApplicationSetting` (e.g. when creating a user), we
also run `ActiveRecord::Migrator.needs_migration`:
```ruby
def needs_migration?(connection = Base.connection)
(migrations(migrations_paths).collect(&:version) - get_all_versions(connection)).size > 0
end
```
During tests, we memoized the `migrations` call, saving a lot of filesystem
loads. However, we left `get_all_versions` alone. This patch memoizes that
as well to reduce DB and memory loads for that table.
See https://gitlab.com/gitlab-org/gitlab-ce/issues/24899#note_21207429
Diffstat (limited to 'doc/development/testing_guide/testing_levels.md')
0 files changed, 0 insertions, 0 deletions