From 06f406ed4463a44071fd44abd19e9da55d0724e2 Mon Sep 17 00:00:00 2001 From: Yasuhiro Asaka Date: Mon, 19 Mar 2012 10:52:25 +0100 Subject: [PATCH 1/2] Added second process for crawler. - try run * bin/shoed * bin/shoed crawler --- bin/shoed | 10 ++++++++-- doc/index.rbx | 8 +++++++- src/util/shoeconfig.rb | 1 + 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/bin/shoed b/bin/shoed index da4738a..8de2645 100755 --- a/bin/shoed +++ b/bin/shoed @@ -12,7 +12,13 @@ ODBA.cache.setup ODBA.cache.clean_prefetched $shoe = SHOE::App.new -$0 = "Shoe (ShoeApp)" +if (opt = ARGV.first and opt == 'crawler') + server_uri = SHOE::SERVER_URI_FOR_CRAWLER + $0 = "Shoe (ShoeApp:Crawler)" +else + server_uri = SHOE::SERVER_URI + $0 = "Shoe (ShoeApp)" +end -DRb.start_service(SHOE::SERVER_URI, $shoe) +DRb.start_service(server_uri, $shoe) DRb.thread.join diff --git a/doc/index.rbx b/doc/index.rbx index 24ff23b..51707aa 100755 --- a/doc/index.rbx +++ b/doc/index.rbx @@ -6,7 +6,13 @@ require 'util/shoeconfig' DRb.start_service('druby://localhost:0') begin - SBSM::Request.new(SHOE::SERVER_URI).process + request = SBSM::Request.new(nil) + if (request.is_crawler?) + server_uri = SHOE::SERVER_URI_FOR_CRAWLER + else + server_uri = SHOE::SERVER_URI + end + SBSM::Request.new(server_uri).process rescue Exception => e $stderr << "Shoe-Error: " << e.message << "\n" $stderr << e.class << "\n" diff --git a/src/util/shoeconfig.rb b/src/util/shoeconfig.rb index 884e9fa..b1cb82a 100644 --- a/src/util/shoeconfig.rb +++ b/src/util/shoeconfig.rb @@ -4,6 +4,7 @@ module SHOE SERVER_NAME = 'shoe.localhost' SERVER_URI = "druby://localhost:22222" + SERVER_URI_FOR_CRAWLER = "druby://localhost:33333" PROJECT_ROOT = File.expand_path('../..', File.dirname(__FILE__)) ENCODING = 'UTF-8' end -- 1.7.3.4