1 # -*- encoding: binary -*-
8 # runs inside each forked worker, this sits around and waits
9 # for connections and doesn't die until the parent dies (or is
10 # given a INT, QUIT, or TERM signal)
11 def worker_loop(worker)
12 init_worker_process(worker)
13 limit = worker_connections
25 listeners = LISTENERS.map do |s|
28 while clients.size >= limit
29 logger.info "busy: clients=#{clients.size} >= limit=#{limit}"
30 Actor.receive { |filter| filter.when(:resume) {} }
32 Actor.spawn(l.accept) do |c|
33 clients[Actor.current] = false
40 rescue Errno::EAGAIN, Errno::ECONNABORTED
48 Actor.receive do |filter|
49 filter.when(Actor) do |actor|
52 orig >= limit and listeners.each { |l| l << :resume }
55 end while G.alive || clients.size > 0