summaryrefslogtreecommitdiff
path: root/lib/leap_ca_daemon.rb
blob: 79ec36ded755bb28fe751aabf86dd71a4bac65ef (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
#
# This file should not be required directly. Use it like so:
#
#  Daemons.run('leap_ca_daemon.rb')
#

require 'leap_ca'

module LeapCA
  puts    " * Tracking #{Cert.database.root}"
  couch   = CouchStream.new(Cert.database.root)
  changes = CouchChanges.new(couch)
  pool    = Pool.new(:size => Config.max_pool_size)

  # fill the pool
  pool.fill

  # watch for deletions, fill the pool whenever it gets low
  changes.follow do |hash|
    if hash[:deleted]
      pool.fill
    end
  end
end