Class: Shift::Api::Core::RequestId

Inherits:
Object
  • Object
show all
Defined in:
lib/shift/api/core/request_id.rb

Overview

A utility class to generate request id numbers for logging purposes

Class Method Summary collapse

Class Method Details

.callInteger

Generates the next request id

Returns:

  • (Integer)

    request_id



8
9
10
11
12
# File 'lib/shift/api/core/request_id.rb', line 8

def self.call
  thread_vars = Shift::Api::Core.root_thread_vars
  thread_vars[:request_id] ||= 0
  thread_vars[:request_id] += 1
end

.resetObject

Resets the request id back to zero



15
16
17
# File 'lib/shift/api/core/request_id.rb', line 15

def self.reset
  Shift::Api::Core.root_thread_vars[:request_id] = 0
end