diff options
Diffstat (limited to 'lib/tasks/gitlab/snippets.rake')
-rw-r--r-- | lib/tasks/gitlab/snippets.rake | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/tasks/gitlab/snippets.rake b/lib/tasks/gitlab/snippets.rake index ed2e88692d5..b55f82480e1 100644 --- a/lib/tasks/gitlab/snippets.rake +++ b/lib/tasks/gitlab/snippets.rake @@ -13,7 +13,7 @@ namespace :gitlab do raise "Please supply the list of ids through the SNIPPET_IDS env var" end - raise "Invalid limit value" if limit == 0 + raise "Invalid limit value" if snippet_task_limit == 0 if migration_running? raise "There are already snippet migrations running. Please wait until they are finished." @@ -41,8 +41,8 @@ namespace :gitlab do end end - if ids.size > limit - raise "The number of ids provided is higher than #{limit}. You can update this limit by using the env var `LIMIT`" + if ids.size > snippet_task_limit + raise "The number of ids provided is higher than #{snippet_task_limit}. You can update this limit by using the env var `LIMIT`" end ids @@ -68,14 +68,14 @@ namespace :gitlab do # bundle exec rake gitlab:snippets:list_non_migrated LIMIT=50 desc 'GitLab | Show non migrated snippets' task list_non_migrated: :environment do - raise "Invalid limit value" if limit == 0 + raise "Invalid limit value" if snippet_task_limit == 0 non_migrated_count = non_migrated_snippets.count if non_migrated_count == 0 puts "All snippets have been successfully migrated" else puts "There are #{non_migrated_count} snippets that haven't been migrated. Showing a batch of ids of those snippets:\n" - puts non_migrated_snippets.limit(limit).pluck(:id).join(',') + puts non_migrated_snippets.limit(snippet_task_limit).pluck(:id).join(',') end end @@ -84,7 +84,7 @@ namespace :gitlab do end # There are problems with the specs if we memoize this value - def limit + def snippet_task_limit ENV['LIMIT'] ? ENV['LIMIT'].to_i : DEFAULT_LIMIT end end |