Skip to content

Instantly share code, notes, and snippets.

@mykecameron
Created August 20, 2013 18:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mykecameron/6285475 to your computer and use it in GitHub Desktop.
Save mykecameron/6285475 to your computer and use it in GitHub Desktop.
# Recomend limit of 10000 and 6 threads
class Blaster
def self.continuous(task, limit, number_threads)
i = 0
threads = []
number_threads.times do
threads << Thread.new do
while true do
blast(task, i)
i = i + 1
break if i > limit
end
end
end
threads.each(&:join)
end
def self.blast(task, i)
task.title = task.title[0..10] + i.to_s
BroadcastFayeEvent.call(task, :update)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment