Rainbows! Rack HTTP server user/dev discussion
 help / color / mirror / code / Atom feed
blob 9bc7b503de49d20b0d0ca8d49d557f26c8f29c5f 782 bytes (raw)
name: lib/rainbows/event_machine_thread_pool.rb 	 # note: path name is non-authoritative(*)

 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
26
27
28
 
# -*- encoding: binary -*-

module Rainbows::EventMachineThreadPool
  autoload :Client, 'rainbows/event_machine_thread_pool/client'
  extend  Rainbows::PoolSize
  include Rainbows::EventMachine

  def init_worker_threads(queue) # :nodoc:
    Rainbows::O[:pool_size].times.map do
      Thread.new do
        begin
          client = queue.pop
          response = client.app_response
          EM.next_tick { client.response_write(response) }
        rescue => e
          Rainbows::Error.listen_loop(e)
        end while Rainbows.alive
      end
    end
  end

  def init_worker_process(worker)
    queue = Client.const_set(:QUEUE, Queue.new)
    threads = init_worker_threads(queue)
    logger.info "EventMachineThreadPool pool_size=#{Rainbows::O[:pool_size]}"
    super
  end
end

debug log:

solving 9bc7b50 ...
found 9bc7b50 in https://yhbt.net/rainbows-public/1379421104-75563-1-git-send-email-godfat@godfat.org/

applying [1/1] https://yhbt.net/rainbows-public/1379421104-75563-1-git-send-email-godfat@godfat.org/
diff --git a/lib/rainbows/event_machine_thread_pool.rb b/lib/rainbows/event_machine_thread_pool.rb
new file mode 100644
index 0000000..9bc7b50

Checking patch lib/rainbows/event_machine_thread_pool.rb...
Applied patch lib/rainbows/event_machine_thread_pool.rb cleanly.

index at:
100644 9bc7b503de49d20b0d0ca8d49d557f26c8f29c5f	lib/rainbows/event_machine_thread_pool.rb

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/rainbows.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).