From e70683ff81c593fd7409d1d856254538b837bf4b Mon Sep 17 00:00:00 2001 From: Jesse Tomchak Date: Wed, 8 Nov 2023 16:25:34 -0700 Subject: [PATCH] multiple number of mammoth users --- .env.production.sample | 2 ++ app/workers/scheduler/for_you_mammoth_scheduler.rb | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.env.production.sample b/.env.production.sample index f5b0130e1..9d0d58e34 100644 --- a/.env.production.sample +++ b/.env.production.sample @@ -86,3 +86,5 @@ ACCOUNT_RELAY_KEY=xxxxxx # JWT Decode MAMMOTH AUTHENTICATION MAMMOTH_SECRET_KEY=xxxxxx +# Multiple number of users to load test the ForYouMammothFeed Scheduler +FOR_YOU_LOAD_TEST_MULTIPLIER=1 diff --git a/app/workers/scheduler/for_you_mammoth_scheduler.rb b/app/workers/scheduler/for_you_mammoth_scheduler.rb index 2ec27f03a..e45175468 100644 --- a/app/workers/scheduler/for_you_mammoth_scheduler.rb +++ b/app/workers/scheduler/for_you_mammoth_scheduler.rb @@ -11,9 +11,11 @@ class Scheduler::ForYouMammothScheduler sidekiq_options retry: 0 + LOAD_TEST_MULTIPLIER = ENV['FOR_YOU_LOAD_TEST_MULTIPLIER'] || 1 + def perform users = mammoth_users.wait - users.each do |acct| + ([users] * LOAD_TEST_MULTIPLIER).inject(&:zip).flatten.each do |acct| UpdateForYouWorker.perform_async({ acct: acct, rebuild: false }) end end