Class: WebHooks::LogExecutionService

Inherits:
Object
  • Object
show all
Includes:
Gitlab::ExclusiveLeaseHelpers
Defined in:
app/services/web_hooks/log_execution_service.rb

Constant Summary collapse

LOCK_TTL =
15.seconds.freeze
LOCK_SLEEP =
0.25.seconds.freeze
LOCK_RETRY =
65

Constants included from Gitlab::ExclusiveLeaseHelpers

Gitlab::ExclusiveLeaseHelpers::FailedToObtainLockError

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Gitlab::ExclusiveLeaseHelpers

#in_lock

Constructor Details

#initialize(hook:, log_data:, response_category:) ⇒ LogExecutionService

Returns a new instance of LogExecutionService.



13
14
15
16
17
# File 'app/services/web_hooks/log_execution_service.rb', line 13

def initialize(hook:, log_data:, response_category:)
  @hook = hook
  @log_data = log_data.transform_keys(&:to_sym)
  @response_category = response_category
end

Instance Attribute Details

#hookObject (readonly)

Returns the value of attribute hook.



11
12
13
# File 'app/services/web_hooks/log_execution_service.rb', line 11

def hook
  @hook
end

#log_dataObject (readonly)

Returns the value of attribute log_data.



11
12
13
# File 'app/services/web_hooks/log_execution_service.rb', line 11

def log_data
  @log_data
end

#response_categoryObject (readonly)

Returns the value of attribute response_category.



11
12
13
# File 'app/services/web_hooks/log_execution_service.rb', line 11

def response_category
  @response_category
end

Instance Method Details

#executeObject



19
20
21
22
# File 'app/services/web_hooks/log_execution_service.rb', line 19

def execute
  update_hook_failure_state
  log_execution
end