Sha256: a52a7f7b03005e7769103fdcc098b9d8f081492b61bca855247cd88f50535cd5
Contents?: true
Size: 627 Bytes
Versions: 1
Compression:
Stored size: 627 Bytes
Contents
# rake the_audit:bots:recalc namespace :the_audit do namespace :bots do # rake bots:recalc desc "Recalculate Audit Bot flags" task recalc: :environment do acount = Audit.count bsize = 1000 Audit.find_in_batches(batch_size: bsize).with_index do |group, index| group.each do |audit| bot_flag = TheAudit.is_bot?(audit.user_agent) if audit.bot != bot_flag audit.update_column(:bot, bot_flag) p "Updated: #{ audit.id }/#{ audit.user_agent }" end end p "#{ bsize * index.next }/#{ acount }" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
the_audit-0.0.2 | lib/tasks/bots.rake |