PERF: Load all common passwords in one go (#15986)

Revert "BUGFIX: use a more widely compatible version of sadd"

This reverts commit aa577f11fd.

I think the compatibility might not be a problem anymore, after 8 years? 😃
This commit is contained in:
Jarek Radosz 2022-02-18 19:47:15 +01:00 committed by GitHub
parent 45cc16098d
commit efb7e19325
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 4 deletions

View File

@ -44,10 +44,7 @@ class CommonPasswords
def self.load_passwords def self.load_passwords
passwords = File.readlines(PASSWORD_FILE) passwords = File.readlines(PASSWORD_FILE)
passwords.map!(&:chomp).each do |pwd| redis.sadd LIST_KEY, passwords.map!(&:chomp)
# slower, but a tad more compatible
redis.sadd LIST_KEY, pwd
end
rescue Errno::ENOENT rescue Errno::ENOENT
# tolerate this so we don't block signups # tolerate this so we don't block signups
Rails.logger.error "Common passwords file #{PASSWORD_FILE} is not found! Common password checking is skipped." Rails.logger.error "Common passwords file #{PASSWORD_FILE} is not found! Common password checking is skipped."