Class: ErrorClient

Inherits:
Object
  • Object
show all
Defined in:
lib/integrations/error_client.rb

Direct Known Subclasses

AirbrakeClient, RollbarClient

Constant Summary collapse

ERROR_CACHE_KEY =
"errors"
DEPLOY_CACHE_KEY =
"deploys"

Instance Method Summary collapse

Instance Method Details

#get_errors!(commit) ⇒ Object

TODO: Shared



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/integrations/error_client.rb', line 10

def get_errors!(commit)
  deploy = commit_deploy(commit)
  return [] if deploy.nil?

  deploy_index = @deploys.index(deploy) || 0
  @deploys = @deploys[(deploy_index + 1)..-1] || []
  if @deploys.first.nil?
    errors = @errors
    @errors = []
  else
    errors = []
    while @errors.any? && @errors.first[:last_time] < @deploys.first[:timestamp] do
      errors << @errors.shift()
    end
  end
  errors
end

#sync!(commit) ⇒ Object

TODO:

1: sync to last deploy?
2: Shared


31
32
33
34
35
# File 'lib/integrations/error_client.rb', line 31

def sync!(commit)
  while @errors.any? && @errors.first[:last_time] < commit.date do
    @errors.shift()
  end
end