Branch: refs/heads/master
Home: https://github.com/openSUSE/open-build-service
Commit: 4bbceb5ce00aa37d5798ef071b4128301132f631
https://github.com/openSUSE/open-build-service/commit/4bbceb5ce00aa37d5798ef...
Author: Stephan Kulow
Date: 2018-12-17 (Mon, 17 Dec 2018)
Changed paths:
M src/api/app/models/role.rb
Log Message:
-----------
Do not use expensive hash keys for cheap queries
Role.hashed uses Rails.all.cache_key - which is rather expensive
SELECT COUNT(*) AS `size`, MAX(`roles`.`updated_at`) AS timestamp FROM `roles`
to avoid querying 8 role titles. The problem is that all the
other code expects Role.hashed to be cheaper than querying the
database directly - which is no longer true with this approach.
E.g.
irb(main):001:0> Role.local_roles
(0.2ms) SELECT COUNT(*) AS `size`, MAX(`roles`.`updated_at`) AS timestamp FROM `roles`
(0.3ms) SELECT COUNT(*) AS `size`, MAX(`roles`.`updated_at`) AS timestamp FROM `roles`
(0.2ms) SELECT COUNT(*) AS `size`, MAX(`roles`.`updated_at`) AS timestamp FROM `roles`
(0.2ms) SELECT COUNT(*) AS `size`, MAX(`roles`.`updated_at`) AS timestamp FROM `roles`
(0.2ms) SELECT COUNT(*) AS `size`, MAX(`roles`.`updated_at`) AS timestamp FROM `roles`
I noticed these repeated queries when working on involved_packages
and wondered since then what is going on.
Commit: 98757d52d11edb13225057c915ec33ddc0048c5d
https://github.com/openSUSE/open-build-service/commit/98757d52d11edb13225057...
Author: Björn Geuken
Date: 2018-12-17 (Mon, 17 Dec 2018)
Changed paths:
M src/api/app/models/role.rb
Log Message:
-----------
Merge pull request #6633 from coolo/fix_role_hashed
Do not use expensive hash keys for cheap queries
Compare: https://github.com/openSUSE/open-build-service/compare/955a91fabda8...98757d...
**NOTE:** This service has been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/
Functionality will be removed from GitHub.com on January 31st, 2019.