public
Homepage: http://rubyforge.org/projects/starling
Clone URL: git://github.com/defunkt/starling.git
share the queue
defunkt (author)
Wed Jan 30 23:27:48 -0800 2008
commit  4049096ac4ec2a20752b43f9d1cc387983208ad2
tree    aaf1bf9b1ad4cb5ca7acc36b68e7c0a3a87bf54c
parent  6441f3f3ae2fca5c59db15e022d61cc04b54a5dc
...
68
69
70
71
 
72
73
74
...
82
83
84
85
86
87
88
89
90
91
...
68
69
70
 
71
72
73
74
...
82
83
84
 
 
 
 
85
86
87
0
@@ -68,7 +68,7 @@ STAT queue_%s_expired_items %d\n".freeze
0
       @expected_length = nil
0
       @server.stats[:total_connections] += 1
0
       set_comm_inactivity_timeout @opts[:timeout]
0
- @queue_collection = QueueCollection.new(@opts[:path])
0
+ @queue_collection = @opts[:queue]
0
     end
0
 
0
     def receive_data(incoming)
0
@@ -82,10 +82,6 @@ STAT queue_%s_expired_items %d\n".freeze
0
       send_data response if response
0
     end
0
 
0
- def unbind
0
- @queue_collection.close
0
- end
0
-
0
     def process(data)
0
       # our only non-normal state is consuming an object's data
0
       # when @expected_length is present
...
134
135
136
137
138
139
140
...
134
135
136
 
137
138
139
0
@@ -134,7 +134,6 @@ module StarlingServer
0
       raise "no transaction log handle. that totally sucks." unless @trx
0
 
0
       @trx.write_nonblock data
0
-# @trx.fsync
0
       @logsize += data.size
0
       rotate_log if @logsize > SOFT_LOG_MAX_SIZE && self.length == 0
0
     end
...
70
71
72
 
73
74
75
...
83
84
85
 
86
87
88
...
70
71
72
73
74
75
76
...
84
85
86
87
88
89
90
0
@@ -70,6 +70,7 @@ module StarlingServer
0
       else; Logger.new(STDERR)
0
       end
0
 
0
+ @opts[:queue] = QueueCollection.new(@opts[:path])
0
       @logger.level = @opts[:log_level] || Logger::ERROR
0
 
0
       EventMachine.run do
0
@@ -83,6 +84,7 @@ module StarlingServer
0
     # Stop accepting new connections and shutdown gracefully.
0
 
0
     def stop
0
+ @opts[:queue].close
0
       EventMachine.stop_event_loop
0
     end
0
 
...
1
 
2
 
 
 
 
 
...
1
2
3
4
5
6
7
8
0
@@ -1,2 +1,8 @@
0
 require 'test/unit'
0
+require 'fileutils'
0
 $:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
0
+
0
+lib = File.join(File.dirname(__FILE__), "..")
0
+tmp = File.join(lib, 'tmp')
0
+FileUtils.mkdir tmp unless File.exists? tmp
0
+$:.unshift(File.join(lib, "lib"))

Comments

    No one has commented yet.