raindrops RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [ANN] raindrops 0.19.1 - real-time stats for preforking Rack servers
@ 2020-01-08  9:36  7% Eric Wong
  0 siblings, 0 replies; 3+ results
From: Eric Wong @ 2020-01-08  9:36 UTC (permalink / raw)
  To: raindrops-public

raindrops is a real-time stats toolkit to show statistics for Rack HTTP
servers.  It is designed for preforking servers such as unicorn, but
should support any Rack HTTP server on platforms supporting POSIX shared
memory.  It may also be used as a generic scoreboard for sharing atomic
counters across multiple processes.

* https://yhbt.net/raindrops/
* No subscription necessary, no HTML mail:
  raindrops-public@yhbt.net
* mail archives: https://yhbt.net/raindrops-public/
  http://ou63pmih66umazou.onion/raindrops-public/
  nntp://news.public-inbox.org/inbox.comp.lang.ruby.raindrops
  nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.raindrops
* git clone git://yhbt.net/raindrops.git
* https://yhbt.net/raindrops/NEWS.atom.xml
* Demo site: https://yhbt.net/raindrops-demo/

Changes:

    This release fixes some warnings on newer Rubies.

    We're no longer on yhbt.net since it's due
    for expiry and I can't pay extortionists for a .org, so
    s/yhbt.net/yhbt.net/ for now, and be prepared to move again
    when extortionists move onto extorting the .net TLD.

          doc: switch homepage to dark216
          ext/raindrops/extconf: fix cflags reset on ancient CC
          fixes for newer rubies
          replace yhbt.net with yhbt.net

^ permalink raw reply	[relevance 7%]

* [PATCH 0/3] misc fixes and a new home
@ 2020-01-06  9:54  5% Eric Wong
  2020-01-06  9:54  4% ` [PATCH 2/3] fixes for newer rubies Eric Wong
  0 siblings, 1 reply; 3+ results
From: Eric Wong @ 2020-01-06  9:54 UTC (permalink / raw)
  To: raindrops-public

bogomips.org is going away because of ICANN corruption,
so move it to yhbt.net for now (but be prepared to move
again to a cheaper .TLD).  Identity is overrated :P

Eric Wong (3):
  ext/raindrops/extconf: fix cflags reset on ancient CC
  fixes for newer rubies
  replace bogomips.org with yhbt.net

 .olddoc.yml                                  | 12 +++++-------
 GNUmakefile                                  |  2 +-
 README                                       | 11 ++++++-----
 examples/linux-listener-stats.rb             |  3 +--
 examples/watcher_demo.ru                     |  2 +-
 ext/raindrops/extconf.rb                     |  2 +-
 ext/raindrops/linux_inet_diag.c              |  2 +-
 lib/raindrops.rb                             |  2 +-
 lib/raindrops/aggregate/pmq.rb               | 12 ++++++------
 lib/raindrops/linux.rb                       |  9 ++++-----
 lib/raindrops/middleware.rb                  |  4 ++--
 lib/raindrops/watcher.rb                     | 14 +++++++-------
 raindrops.gemspec                            |  4 ++--
 test/ipv6_enabled.rb                         |  8 ++++----
 test/test_linux.rb                           |  5 +++--
 test/test_linux_all_tcp_listen_stats_leak.rb |  4 ++--
 test/test_raindrops.rb                       |  2 +-
 test/test_tcp_info.rb                        |  8 ++++----
 test/test_watcher.rb                         | 18 +++++++++---------
 19 files changed, 61 insertions(+), 63 deletions(-)

^ permalink raw reply	[relevance 5%]

* [PATCH 2/3] fixes for newer rubies
  2020-01-06  9:54  5% [PATCH 0/3] misc fixes and a new home Eric Wong
@ 2020-01-06  9:54  4% ` Eric Wong
  0 siblings, 0 replies; 3+ results
From: Eric Wong @ 2020-01-06  9:54 UTC (permalink / raw)
  To: raindrops-public

Newer rubies have more warnings
---
 examples/linux-listener-stats.rb             |  3 +--
 lib/raindrops/aggregate/pmq.rb               | 12 ++++++------
 lib/raindrops/linux.rb                       |  9 ++++-----
 test/ipv6_enabled.rb                         |  8 ++++----
 test/test_linux.rb                           |  5 +++--
 test/test_linux_all_tcp_listen_stats_leak.rb |  4 ++--
 test/test_raindrops.rb                       |  2 +-
 test/test_tcp_info.rb                        |  8 ++++----
 test/test_watcher.rb                         | 18 +++++++++---------
 9 files changed, 34 insertions(+), 35 deletions(-)

diff --git a/examples/linux-listener-stats.rb b/examples/linux-listener-stats.rb
index 1008995..7e767da 100755
--- a/examples/linux-listener-stats.rb
+++ b/examples/linux-listener-stats.rb
@@ -15,7 +15,6 @@
 usage = "Usage: #$0 [-d DELAY] [-t QUEUED_THRESHOLD] ADDR..."
 ARGV.size > 0 or abort usage
 delay = false
-all = false
 queued_thresh = -1
 # "normal" exits when driven on the command-line
 trap(:INT) { exit 130 }
@@ -25,7 +24,7 @@
   opts.banner = usage
   opts.on('-d', '--delay=DELAY', Float) { |n| delay = n }
   opts.on('-t', '--queued-threshold=INT', Integer) { |n| queued_thresh = n }
-  opts.on('-a', '--all') { all = true }
+  opts.on('-a', '--all') { } # noop
   opts.parse! ARGV
 end
 
diff --git a/lib/raindrops/aggregate/pmq.rb b/lib/raindrops/aggregate/pmq.rb
index 8623cb1..64d0a4f 100644
--- a/lib/raindrops/aggregate/pmq.rb
+++ b/lib/raindrops/aggregate/pmq.rb
@@ -142,8 +142,8 @@ def master_loop
       warn "Unhandled exception in #{__FILE__}:#{__LINE__}: #{e}"
       break
     end while true
-    ensure
-      flush_master
+  ensure
+    flush_master
   end
 
   # Loads the last shared \Aggregate from the master thread/process
@@ -175,14 +175,14 @@ def flush_master
   # worker thread or process
   def stop_master_loop
     sleep 0.1 until mq_send(false)
-    rescue Errno::EINTR
-      retry
+  rescue Errno::EINTR
+    retry
   end
 
   def lock! io, type # :nodoc:
     io.fcntl Fcntl::F_SETLKW, type
-    rescue Errno::EINTR
-      retry
+  rescue Errno::EINTR
+    retry
   end
 
   # we use both a mutex for thread-safety and fcntl lock for process-safety
diff --git a/lib/raindrops/linux.rb b/lib/raindrops/linux.rb
index 4166ec7..9842ae1 100644
--- a/lib/raindrops/linux.rb
+++ b/lib/raindrops/linux.rb
@@ -14,8 +14,7 @@ module Raindrops::Linux
   # The standard proc path for active UNIX domain sockets, feel free to call
   # String#replace on this if your /proc is mounted in a non-standard location
   # for whatever reason
-  PROC_NET_UNIX_ARGS = %w(/proc/net/unix)
-  defined?(::Encoding) and PROC_NET_UNIX_ARGS.push({ :encoding => "binary" })
+  PROC_NET_UNIX_ARGS = [ '/proc/net/unix', { encoding: "binary" }]
 
   # Get ListenStats from an array of +paths+
   #
@@ -42,11 +41,11 @@ def unix_listener_stats(paths = nil)
     else
       paths = paths.map do |path|
         path = path.dup
-        path.force_encoding(Encoding::BINARY) if defined?(Encoding)
+        path.force_encoding(Encoding::BINARY)
         if File.symlink?(path)
           link = path
           path = File.readlink(link)
-          path.force_encoding(Encoding::BINARY) if defined?(Encoding)
+          path.force_encoding(Encoding::BINARY)
           rv[link] = rv[path] # vivify ListenerStats
         else
           rv[path] # vivify ListenerStats
@@ -57,7 +56,7 @@ def unix_listener_stats(paths = nil)
     paths = /^\w+: \d+ \d+ (\d+) \d+ (\d+)\s+\d+ (#{paths.join('|')})$/n
 
     # no point in pread since we can't stat for size on this file
-    File.read(*PROC_NET_UNIX_ARGS).scan(paths) do |s|
+    File.read(PROC_NET_UNIX_ARGS[0], encoding: 'binary').scan(paths) do |s|
       path = s[-1]
       case s[0]
       when "00000000" # client sockets
diff --git a/test/ipv6_enabled.rb b/test/ipv6_enabled.rb
index f02b48f..c4c9709 100644
--- a/test/ipv6_enabled.rb
+++ b/test/ipv6_enabled.rb
@@ -2,8 +2,8 @@ def ipv6_enabled?
   tmp = TCPServer.new(ENV["TEST_HOST6"] || '::1', 0)
   tmp.close
   true
-  rescue => e
-    warn "skipping IPv6 tests, host does not seem to be IPv6 enabled:"
-    warn "  #{e.class}: #{e}"
-    false
+rescue => e
+  warn "skipping IPv6 tests, host does not seem to be IPv6 enabled:"
+  warn "  #{e.class}: #{e}"
+  false
 end
diff --git a/test/test_linux.rb b/test/test_linux.rb
index bfefcc4..7808469 100644
--- a/test/test_linux.rb
+++ b/test/test_linux.rb
@@ -76,6 +76,7 @@ def test_unix_all_unused
 
     assert_equal 0, stats[tmp.path].active
     assert_equal 0, stats[tmp.path].queued
+    us.close
   end
 
   def test_unix_resolves_symlinks
@@ -151,8 +152,8 @@ def test_tcp_reuse_sock
     assert_equal 1, stats.size
     assert_equal 0, stats[addr].queued
     assert_equal 1, stats[addr].active
-    ensure
-      nlsock.close
+  ensure
+    nlsock.close
   end
 
   def test_tcp_multi
diff --git a/test/test_linux_all_tcp_listen_stats_leak.rb b/test/test_linux_all_tcp_listen_stats_leak.rb
index 7368220..7be46d4 100644
--- a/test/test_linux_all_tcp_listen_stats_leak.rb
+++ b/test/test_linux_all_tcp_listen_stats_leak.rb
@@ -37,7 +37,7 @@ def test_leak
     end
     cur_kb = rss_kb
     p [ :cur_kb, cur_kb ]
-    ensure
-      s.close
+  ensure
+    s.close
   end
 end if ENV["STRESS"].to_i != 0
diff --git a/test/test_raindrops.rb b/test/test_raindrops.rb
index 67089b7..0749694 100644
--- a/test/test_raindrops.rb
+++ b/test/test_raindrops.rb
@@ -134,7 +134,7 @@ def test_resize_mremap
     assert_equal 0, rd[rd.capa - 1]
     assert_equal 1, rd.incr(rd.capa - 1)
     assert_raises(ArgumentError) { rd[rd.capa] }
-    rescue RangeError
+  rescue RangeError
   end # if RUBY_PLATFORM =~ /linux/
 
   def test_evaporate
diff --git a/test/test_tcp_info.rb b/test/test_tcp_info.rb
index b107565..2ddacfd 100644
--- a/test/test_tcp_info.rb
+++ b/test/test_tcp_info.rb
@@ -60,10 +60,10 @@ def test_tcp_server_delayed
     a = s.accept
     i = Raindrops::TCP_Info.new(a)
     assert i.last_data_recv >= delay_ms, "#{i.last_data_recv} < #{delay_ms}"
-    ensure
-      c.close if c
-      a.close if a
-      s.close
+  ensure
+    c.close if c
+    a.close if a
+    s.close
   end
 
   def test_tcp_server_state_closed
diff --git a/test/test_watcher.rb b/test/test_watcher.rb
index d1e4d15..28ac49b 100644
--- a/test/test_watcher.rb
+++ b/test/test_watcher.rb
@@ -118,28 +118,28 @@ def test_tail_queued_min
 
   def test_x_current_header
     env = @req.class.env_for "/active/#@addr.txt"
-    status, headers, body = @app.call(env)
+    _status, headers, _body = @app.call(env)
     assert_equal "0", headers["X-Current"], headers.inspect
 
     env = @req.class.env_for "/queued/#@addr.txt"
-    status, headers, body = @app.call(env)
+    _status, headers, _body = @app.call(env)
     assert_equal "1", headers["X-Current"], headers.inspect
 
     @ios << @srv.accept
     sleep 0.1
 
     env = @req.class.env_for "/queued/#@addr.txt"
-    status, headers, body = @app.call(env)
+    _status, headers, _body = @app.call(env)
     assert_equal "0", headers["X-Current"], headers.inspect
 
     env = @req.class.env_for "/active/#@addr.txt"
-    status, headers, body = @app.call(env)
+    _status, headers, _body = @app.call(env)
     assert_equal "1", headers["X-Current"], headers.inspect
   end
 
   def test_peaks
     env = @req.class.env_for "/active/#@addr.txt"
-    status, headers, body = @app.call(env.dup)
+    _status, headers, _body = @app.call(env.dup)
     start = headers["X-First-Peak-At"]
     assert headers["X-First-Peak-At"], headers.inspect
     assert headers["X-Last-Peak-At"], headers.inspect
@@ -148,14 +148,14 @@ def test_peaks
     before = headers["X-Last-Peak-At"]
 
     env = @req.class.env_for "/queued/#@addr.txt"
-    status, headers, body = @app.call(env)
+    _status, headers, _body = @app.call(env)
     assert_nothing_raised { Time.parse(headers["X-First-Peak-At"]) }
     assert_nothing_raised { Time.parse(headers["X-Last-Peak-At"]) }
     assert_equal before, headers["X-Last-Peak-At"], "should not change"
 
     sleep 2
     env = @req.class.env_for "/active/#@addr.txt"
-    status, headers, body = @app.call(env.dup)
+    _status, headers, _body = @app.call(env.dup)
     assert_equal before, headers["X-Last-Peak-At"], headers.inspect
 
     @ios << @srv.accept
@@ -167,7 +167,7 @@ def test_peaks
     end
     sleep 0.1
     env = @req.class.env_for "/queued/#@addr.txt"
-    status, headers, body = @app.call(env.dup)
+    _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"]) }
     assert before != headers["X-Last-Peak-At"]
@@ -177,7 +177,7 @@ def test_peaks
     sleep 2
 
     env = @req.class.env_for "/queued/#@addr.txt"
-    status, headers, body = @app.call(env)
+    _status, headers, _body = @app.call(env)
     assert_equal "0", headers["X-Current"]
     assert_nothing_raised { Time.parse(headers["X-Last-Peak-At"]) }
     assert_equal queued_before, headers["X-Last-Peak-At"], "should not change"

^ permalink raw reply related	[relevance 4%]

Results 1-3 of 3 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2020-01-06  9:54  5% [PATCH 0/3] misc fixes and a new home Eric Wong
2020-01-06  9:54  4% ` [PATCH 2/3] fixes for newer rubies Eric Wong
2020-01-08  9:36  7% [ANN] raindrops 0.19.1 - real-time stats for preforking Rack servers 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).