Skip to content

Instantly share code, notes, and snippets.

@fmquaglia
Created October 6, 2015 06:16
Show Gist options
  • 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