Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

It's working a little better now I think.

  • Loading branch information...
commit 574c707151f126507f336425802e2ad9eb64b3c2 1 parent d9d5583
Darrick Wiebe authored
Showing with 11 additions and 1 deletion.
  1. +8 −1 lib/pacer-agent.rb
  2. +3 −0  lib/pacer/pipes/channel_pipe.rb
View
9 lib/pacer-agent.rb
@@ -1,6 +1,13 @@
require 'pacer'
require 'agent'
+# TODO:
+# - callback from channel for when it gets closed?
+# - reading from a closed channel should fail - it blocks
+# - if clone channel a then close one channel, they should both be closed.
+# - will this all be better on ZMQ?
+# - channel.to_route.limit(1) loses the element after the last element returned
+
module PacerAgent
unless const_defined? :VERSION
PATH = File.expand_path(File.join(File.dirname(__FILE__), '..'))
@@ -29,7 +36,7 @@ def channel(opts = {})
r.each do |elem|
c << elem
end
- c << c
+ c << c if opts[:auto_close]
end
channel
end
View
3  lib/pacer/pipes/channel_pipe.rb
@@ -17,6 +17,9 @@ def initialize(channel, timeout = nil)
if timeout
@selector.timeout(timeout) { raise StopIteration }
end
+ if @channel.closed?
+ @selector.default { raise StopIteration }
+ end
end
protected
Please sign in to comment.
Something went wrong with that request. Please try again.