You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2020/11/23 23:46:37 UTC

[whimsy] branch master updated: Tidy up

This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 28f39b4  Tidy up
28f39b4 is described below

commit 28f39b401114ceaaca54917ba56c3cf175e6f12a
Author: Sebb <se...@apache.org>
AuthorDate: Mon Nov 23 23:46:28 2020 +0000

    Tidy up
    
    This fixes #108
---
 lib/whimsy/asf/rack.rb | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/lib/whimsy/asf/rack.rb b/lib/whimsy/asf/rack.rb
index 99122b1..e8b2ecf 100644
--- a/lib/whimsy/asf/rack.rb
+++ b/lib/whimsy/asf/rack.rb
@@ -1,7 +1,6 @@
-require_relative '../asf.rb'
+require_relative '../asf'
 require 'rack'
 require 'etc'
-require 'thread'
 
 module ASF
   # Rack support for HTTP Authorization, contains a number of classes that
@@ -18,7 +17,7 @@ module ASF
       else
         require 'base64'
         env.user, env.password = Base64.
-          decode64(auth[/^Basic ([A-Za-z0-9+\/=]+)$/,1].to_s).split(':',2)
+          decode64(auth[/^Basic ([A-Za-z0-9+\/=]+)$/, 1].to_s).split(':', 2)
       end
 
       env['REMOTE_USER'] ||= env.user
@@ -127,11 +126,11 @@ module ASF
         # divide minutes by frequency and use the result to determine the
         # time between simulated requests
         @@background = Thread.new do
-           seconds = minutes * 60.0 / frequency
-           loop do
-             sleep seconds
-             maybe_perform_gc
-           end
+          seconds = minutes * 60.0 / frequency
+          loop do
+            sleep seconds
+            maybe_perform_gc
+          end
         end
       end
     end
@@ -150,7 +149,7 @@ module ASF
         # https://github.com/puma/puma/issues/450
         status, header, body = @app.call(env)
 
-        if ary = env['rack.after_reply']
+        if (ary = env['rack.after_reply']) # this is intended to be assignment, see #108
           ary << lambda {maybe_perform_gc}
         else
           Thread.new {sleep 0.1; maybe_perform_gc}