2014-02-17 18:05:39 +01:00
|
|
|
class ClearChannelJob
|
|
|
|
@queue = :clear_channel
|
|
|
|
|
|
|
|
def self.perform(channel_id)
|
2014-07-09 17:44:37 +02:00
|
|
|
# delete feeds
|
2014-04-04 05:08:00 +02:00
|
|
|
Feed.delete_in_batches(channel_id)
|
2014-02-17 18:05:39 +01:00
|
|
|
DailyFeed.delete_all(["channel_id = ?", channel_id])
|
|
|
|
if channel = Channel.find(channel_id)
|
|
|
|
channel.last_entry_id = nil
|
|
|
|
channel.clearing = false
|
|
|
|
channel.save
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|