-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ABOS: Mailinglisten Personenabfrage beschleunigen #1470
Labels
Comments
3 tasks
amaierhofer
added a commit
to hitobito/hitobito
that referenced
this issue
Jan 10, 2025
amaierhofer
added a commit
to hitobito/hitobito
that referenced
this issue
Jan 10, 2025
amaierhofer
added a commit
to hitobito/hitobito
that referenced
this issue
Jan 10, 2025
amaierhofer
added a commit
to hitobito/hitobito
that referenced
this issue
Jan 13, 2025
amaierhofer
added a commit
to hitobito/hitobito
that referenced
this issue
Jan 17, 2025
daniel-illi
pushed a commit
to hitobito/hitobito
that referenced
this issue
Jan 20, 2025
daniel-illi
added a commit
to hitobito/hitobito
that referenced
this issue
Jan 20, 2025
* Refactor MailingLists::Subscribers to make it faster (hitobito/hitobito_sac_cas#1470) * Only show subscription_toggling button if list is subscribable * Script to measure mailing_list subscriber performance: ```ruby require "optparse" options = {} OptionParser.new do |opt| opt.on("--offset OFFSET") { |o| options[:offset] = o } opt.on("--limit LIMIT") { |o| options[:limit] = o } end.parse! def now = Process.clock_gettime(Process::CLOCK_MONOTONIC) require_relative "config/environment" branch = `git symbolic-ref HEAD | sed -e 's,.*/,,'`.strip offset = options.fetch(:offset, 0).to_i limit = options.fetch(:limit, 10).to_i database = ActiveRecord::Base.connection.instance_variable_get(:@config)[:database] batch_size = limit / 10 filename = "list-performance-#{database}-#{branch}-#{offset}-#{limit}.csv" puts "Writing to #{filename}" File.open(filename, "w") do |file| file.write CSV.generate_line(%w[id people seconds]) MailingList.offset(offset).limit(limit).find_each.with_index do |list, index| puts "#{index} of #{limit}" if (index % batch_size) == 0 file.flush if (index % batch_size) == 0 start = now size = list.people.size file.write CSV.generate_line([list.id, size, (now - start).round(1)]) end end ``` --------- Co-authored-by: Daniel Illi <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Die aktuelle Personenabfrage ist nicht effizient für Mailinglisten mit vielen Personen subscriptions (zb Newsletter). Die Query muss so umgeschrieben werden, dass auch die Mailinglisten mit 10k bis 100k Subscriptions (excluding und including) effizient exportiert werden kann.
The text was updated successfully, but these errors were encountered: