Skip to content

Instantly share code, notes, and snippets.

Created January 22, 2015 02:22
Show Gist options
  • Save anonymous/15475bf7eca34135bdf3 to your computer and use it in GitHub Desktop.
Save anonymous/15475bf7eca34135bdf3 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require_relative "../lib/database.rb"
EM.run do
Database.pool.wait_for_notify_defer(10).callback do |notification|
puts "hello world notification"
end.errback do |ex|
puts "Errback"
end
puts "here"
Database.pool.query_defer("LISTEN #{AppConfig.channel}") do
Database.pool.query_defer("NOTIFY #{AppConfig.channel}")
puts "notified"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment