20846: Remove deprecated Random::DEFAULT usage.
authorTom Clegg <tom@curii.com>
Mon, 23 Oct 2023 21:39:41 +0000 (17:39 -0400)
committerTom Clegg <tom@curii.com>
Fri, 27 Oct 2023 19:20:34 +0000 (15:20 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

apps/workbench/app/controllers/application_controller.rb
sdk/ruby/lib/arvados.rb
services/api/config/initializers/request_id_middleware.rb

index 3e4502545b5d6103601d201d35135e5cfd592d60..e7441df4beecb0bb3f13214a95f61850be40dade 100644 (file)
@@ -588,7 +588,7 @@ class ApplicationController < ActionController::Base
   def set_current_request_id
     response.headers['X-Request-Id'] =
       Thread.current[:request_id] =
-      "req-" + Random::DEFAULT.rand(2**128).to_s(36)[0..19]
+      "req-" + Random.new.rand(2**128).to_s(36)[0..19]
     yield
     Thread.current[:request_id] = nil
   end
index 7b99ba5788943581b4c0a2da469ebd60f32a1c03..73a0d0d2f7c6c05f6674e2260fe788d33c4b2aa4 100644 (file)
@@ -21,7 +21,7 @@ class Arvados
     attr_reader :request_id
 
     def execute(*args)
-      @request_id = "req-" + Random::DEFAULT.rand(2**128).to_s(36)[0..19]
+      @request_id = "req-" + Random.new.rand(2**128).to_s(36)[0..19]
       if args.last.is_a? Hash
         args.last[:headers] ||= {}
         args.last[:headers]['X-Request-Id'] = @request_id
index e2158801e7618ba47dd756c55d497f17c6616679..cfb018ca9705dcc18a2ee53defbd9468a33d2a90 100644 (file)
@@ -14,7 +14,7 @@ module CustomRequestId
   end
 
   def internal_request_id
-    "req-" + Random::DEFAULT.rand(2**128).to_s(36)[0..19]
+    "req-" + Random.new.rand(2**128).to_s(36)[0..19]
   end
 end
 
@@ -22,4 +22,4 @@ class ActionDispatch::RequestId
   # Instead of using the default UUID-like format for X-Request-Id headers,
   # use our own.
   prepend CustomRequestId
-end
\ No newline at end of file
+end