28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/kmdb/jobs/record_batch.rb', line 28
def work
event_sql = []
properties_sql = []
@batch.events.each do |event|
next unless event['_n'].nil? || WhitelistedEvent.include?(event['_n'])
next if IgnoredUser.include?(event['_p']) ||
IgnoredUser.include?(event['_p2'])
if event['_p2']
next if event['_p'] =~ /^\d+$/ && event['_p2'] =~ /^\d+$/
aliaz = Alias.record event['_p'], event['_p2'], event['_t']
Resque.enqueue(UnaliasUser, aliaz.name1, aliaz.name2)
elsif event['_n']
Event.sql_for(event) do |e,p|
event_sql << e
properties_sql << p
end
else
properties_sql << Property.sql_for(event)
end
end
KMDB.transaction do |c|
Event.mass_create(event_sql.compact)
Property.mass_create(properties_sql.compact)
end
@batch.delete
end
|