Skip to content

Instantly share code, notes, and snippets.

@fmquaglia
Created October 6, 2015 06:16
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 fmquaglia/f5949a9da47d0f534e86 to your computer and use it in GitHub Desktop.
Save fmquaglia/f5949a9da47d0f534e86 to your computer and use it in GitHub Desktop.
promising-future example with ost
# See https://github.com/bhuga/promising-future
require "ost"
require "future"
Ost.redis.call('FLUSHDB')
300.times do |i|
Ost[:foo] << i
end
a = future do
Ost[:foo].each do |job|
puts "Worker 1 - Job #{job}"
end
end
b = future do
Ost[:foo].each do |job|
puts "Worker 2 - Job #{job}"
end
end
c = future do
Ost[:foo].each do |job|
puts "Worker 3 - Job #{job}"
end
end
puts a
puts b
puts c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment