raindrops RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* [PATCH 0/3] preparing for raindrops 0.10.0
@ 2012-06-18 21:20 Eric Wong
  2012-06-18 21:20 ` [PATCH 1/3] test_watcher: fix incorrect request/date comparison Eric Wong
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eric Wong @ 2012-06-18 21:20 UTC (permalink / raw)
  To: raindrops

A few more minor changes pushed to master of git://bogomips.org/raindrops

Eric Wong (3):
      test_watcher: fix incorrect request/date comparison
      watcher: sort index of listener listing
      watcher: do not require Rack::Head for HEAD response

Feedback/comments greatly appreciated.  I'll probably tag the release
tonight if everything goes well.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] test_watcher: fix incorrect request/date comparison
  2012-06-18 21:20 [PATCH 0/3] preparing for raindrops 0.10.0 Eric Wong
@ 2012-06-18 21:20 ` Eric Wong
  2012-06-18 21:20 ` [PATCH 2/3] watcher: sort index of listener listing Eric Wong
  2012-06-18 21:20 ` [PATCH 3/3] watcher: do not require Rack::Head for HEAD response Eric Wong
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2012-06-18 21:20 UTC (permalink / raw)
  To: raindrops

It makes no sense to compare peak times of different queues
(active vs queued) against each other.
---
 test/test_watcher.rb | 1 +
 1 file changed, 1 insertion(+)

diff --git a/test/test_watcher.rb b/test/test_watcher.rb
index 056a3bf..5e45dcd 100644
--- a/test/test_watcher.rb
+++ b/test/test_watcher.rb
@@ -156,6 +156,7 @@ class TestWatcher < Test::Unit::TestCase
     @ios << @srv.accept
     assert_raises(Errno::EAGAIN) { @srv.accept_nonblock }
     sleep 0.1
+    env = @req.class.env_for "/queued/#@addr.txt"
     status, headers, body = @app.call(env.dup)
     assert headers["X-Last-Peak-At"], headers.inspect
     assert_nothing_raised { Time.parse(headers["X-Last-Peak-At"]) }
-- 
1.7.11.rc0.55.gb2478aa



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] watcher: sort index of listener listing
  2012-06-18 21:20 [PATCH 0/3] preparing for raindrops 0.10.0 Eric Wong
  2012-06-18 21:20 ` [PATCH 1/3] test_watcher: fix incorrect request/date comparison Eric Wong
@ 2012-06-18 21:20 ` Eric Wong
  2012-06-18 21:20 ` [PATCH 3/3] watcher: do not require Rack::Head for HEAD response Eric Wong
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2012-06-18 21:20 UTC (permalink / raw)
  To: raindrops

For hosts with many listeners, it should be easier to read the
index page if the results are shown in a consistent order.

Requested privately via email to raindrops@bogomips.org
---
 lib/raindrops/watcher.rb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/raindrops/watcher.rb b/lib/raindrops/watcher.rb
index 869fa17..5493374 100644
--- a/lib/raindrops/watcher.rb
+++ b/lib/raindrops/watcher.rb
@@ -337,7 +337,9 @@ class Raindrops::Watcher
       "<table><tr>" \
         "<th>address</th><th>active</th><th>queued</th><th>reset</th>" \
       "</tr>" <<
-      all.map do |addr,stats|
+      all.sort do |a,b|
+        a[0] <=> b[0] # sort by addr
+      end.map do |addr,stats|
         e_addr = escape addr
         "<tr>" \
           "<td><a href='/tail/#{e_addr}.txt' " \
-- 
1.7.11.rc0.55.gb2478aa



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] watcher: do not require Rack::Head for HEAD response
  2012-06-18 21:20 [PATCH 0/3] preparing for raindrops 0.10.0 Eric Wong
  2012-06-18 21:20 ` [PATCH 1/3] test_watcher: fix incorrect request/date comparison Eric Wong
  2012-06-18 21:20 ` [PATCH 2/3] watcher: sort index of listener listing Eric Wong
@ 2012-06-18 21:20 ` Eric Wong
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2012-06-18 21:20 UTC (permalink / raw)
  To: raindrops

Rack webservers are not guaranteed to include Rack::Head in the
middleware stack.  Watcher is a standalone app, so it cannot
rely on a framework which automatically includes Rack::Head.
---
 lib/raindrops/watcher.rb | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/raindrops/watcher.rb b/lib/raindrops/watcher.rb
index 5493374..43c30ef 100644
--- a/lib/raindrops/watcher.rb
+++ b/lib/raindrops/watcher.rb
@@ -143,8 +143,12 @@ class Raindrops::Watcher
   def call(env)
     @start.synchronize { @thr ||= aggregator_thread(env["rack.logger"]) }
     case env["REQUEST_METHOD"]
-    when "HEAD", "GET"
+    when "GET"
       get env
+    when "HEAD"
+      r = get(env)
+      r[2] = []
+      r
     when "POST"
       post env
     else
-- 
1.7.11.rc0.55.gb2478aa



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-06-18 21:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-18 21:20 [PATCH 0/3] preparing for raindrops 0.10.0 Eric Wong
2012-06-18 21:20 ` [PATCH 1/3] test_watcher: fix incorrect request/date comparison Eric Wong
2012-06-18 21:20 ` [PATCH 2/3] watcher: sort index of listener listing Eric Wong
2012-06-18 21:20 ` [PATCH 3/3] watcher: do not require Rack::Head for HEAD response Eric Wong

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

	https://yhbt.net/raindrops.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).