diff options
author | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-04-17 19:11:16 -0700 |
---|---|---|
committer | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-04-17 19:22:51 -0700 |
commit | 44b47cb08a97182177dc2778a34075f9d9037a57 (patch) | |
tree | 52d1810f1ac388d5f79081be4d2a9216404df711 | |
parent | 466421102c41b4f99e0f503aca631d762bb8455c (diff) | |
download | chef-jdm/random.tar.gz |
Use Random instead of SecureRandom in request_idjdm/random
SecureRandom is quite a bit slower on Windows
-rw-r--r-- | lib/chef/request_id.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/chef/request_id.rb b/lib/chef/request_id.rb index 2c7af01879..d2bc1b42cd 100644 --- a/lib/chef/request_id.rb +++ b/lib/chef/request_id.rb @@ -15,7 +15,6 @@ # limitations under the License. # -require 'securerandom' require 'singleton' class Chef @@ -31,7 +30,11 @@ class Chef end def generate_request_id - SecureRandom.uuid + ary = Random.new.bytes(16).unpack("NnnnnN") + ary[2] = (ary[2] & 0x0fff) | 0x4000 + ary[3] = (ary[3] & 0x3fff) | 0x8000 + "%08x-%04x-%04x-%04x-%04x%08x" % ary end + end end |