thingspeak/app/jobs/clear_channel_job.rb
2014-07-09 11:44:37 -04:00

16 lines
340 B
Ruby

class ClearChannelJob
@queue = :clear_channel
def self.perform(channel_id)
# delete feeds
Feed.delete_in_batches(channel_id)
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