-
Notifications
You must be signed in to change notification settings - Fork 30
Fix alter_time format when deleting old data (bsc#1112967) #688
Conversation
app/models/salt_event.rb
Outdated
") | ||
[:events, :returns].each do |table| | ||
ActiveRecord::Base.connection.execute(" | ||
delete from `salt_#{table}` where alter_time < #{date.to_i}; | ||
delete from `salt_#{table}` where unix_timestamp(alter_time) < #{date.to_i}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should rethink this a bit more, because with this we could effectively delete events that weren't processed at all (processed_at IS NULL
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I've added it
I see I am a reviewer. I will wait for ereslibre approval and then I will give you my approval . |
06944b1
to
bfbd99c
Compare
I've updated also brakeman ignore config file |
app/models/salt_event.rb
Outdated
delete from `salt_#{table}` where alter_time < #{date.to_i}; | ||
ActiveRecord::Base.connection.execute(" | ||
delete from `salt_events` where unix_timestamp(alter_time) < #{date.to_i} | ||
and processed_at is NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be processed_at is not null
; so we are sure that we are cleaning events that have been processed (their processed_at
column is not NULL
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've changed it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @mjura
No description provided.