thingspeak/app/jobs/clear_channel_job.rb

15 lines
334 B
Ruby
Raw Normal View History

class ClearChannelJob
@queue = :clear_channel
def self.perform(channel_id)
Feed.delete_all(["channel_id = ?", 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