Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
21a483d7
Commit
21a483d7
authored
Sep 07, 2020
by
Mark Chao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Eager load subscription associations
parent
c4820da5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
1 deletion
+3
-1
ee/app/models/gitlab_subscription.rb
ee/app/models/gitlab_subscription.rb
+2
-0
ee/app/workers/update_max_seats_used_for_gitlab_com_subscriptions_worker.rb
...ate_max_seats_used_for_gitlab_com_subscriptions_worker.rb
+1
-1
No files found.
ee/app/models/gitlab_subscription.rb
View file @
21a483d7
...
...
@@ -24,6 +24,8 @@ class GitlabSubscription < ApplicationRecord
with_hosted_plan
(
Plan
::
PAID_HOSTED_PLANS
)
end
scope
:preload_for_refresh_seat
,
->
{
preload
([{
namespace: :route
},
:hosted_plan
])
}
DAYS_AFTER_EXPIRATION_BEFORE_REMOVING_FROM_INDEX
=
7
# We set a 7 days as the threshold for expiration before removing them from
...
...
ee/app/workers/update_max_seats_used_for_gitlab_com_subscriptions_worker.rb
View file @
21a483d7
...
...
@@ -12,7 +12,7 @@ class UpdateMaxSeatsUsedForGitlabComSubscriptionsWorker # rubocop:disable Scalab
return
if
::
Gitlab
::
Database
.
read_only?
return
unless
::
Gitlab
::
CurrentSettings
.
should_check_namespace_plan?
GitlabSubscription
.
with_a_paid_hosted_plan
.
find_in_batches
(
batch_size:
100
)
do
|
subscriptions
|
GitlabSubscription
.
with_a_paid_hosted_plan
.
preload_for_refresh_seat
.
find_in_batches
(
batch_size:
100
)
do
|
subscriptions
|
tuples
=
[]
subscriptions
.
each
do
|
subscription
|
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment