update gems; fix timeout errors
This commit is contained in:
@ -36,14 +36,13 @@ class Feed < ActiveRecord::Base
|
||||
# delete feeds in batches
|
||||
def self.delete_in_batches(channel_id)
|
||||
channel = Channel.find(channel_id)
|
||||
connection = ActiveRecord::Base.connection
|
||||
|
||||
# while there are still feeds left
|
||||
while channel.feeds.count > 0
|
||||
# create the sql query to delete 1000 feeds from the channel
|
||||
sql = "DELETE FROM feeds WHERE channel_id=#{channel_id} LIMIT 1000"
|
||||
# execute the sql query
|
||||
connection.execute(sql)
|
||||
ActiveRecord::Base.connection.execute(sql)
|
||||
# wait a bit before the next delete
|
||||
sleep 0.1
|
||||
end
|
||||
|
Reference in New Issue
Block a user