summaryrefslogtreecommitdiff
path: root/lib/tapicero_daemon.rb
blob: a5347c76783d4a67ef4f3fa05e12470690659057 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#
# This file should not be required directly. Use the wrapper in /bin
# instead or run this using daemons:
#
#  Daemons.run('tapicero_daemon.rb')
#

require 'tapicero'

module Tapicero
  puts    " * Tracking #{Config.users_db_name}"
  couch   = CouchStream.new(Config.couch_host + Config.users_db_name)
  changes = CouchChanges.new(couch)

  # fill the pool
  # pool.fill

  # watch for deletions, fill the pool whenever it gets low
  changes.follow do |hash|
    if hash[:created]
      puts " Created #{hash.inspect}"
      # pool.fill
    end
  end
end