test_track_rails_client 0.9.11 → 0.9.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OTg3ZWViNmFlNjgyYmY5MzcxNTkwZmIxZTAyM2U1ZWNhMTZmNzE2MQ==
4
+ OTI3NTIwMjQ2OTcwMDg5ZTA0NDkxNDUzYjBiYzMyMTNkODg1YzZjNg==
5
5
  data.tar.gz: !binary |-
6
- YTczNDM5NzAzMmM3OWI5NjZlNmE2ZTU4NDFmMDc3NDgwOWFmNzgwNw==
6
+ NzQ3Yzc0YmE2MTRkYTg5NTU1MTM0MGQxNjk4ZjdjOTUwYzYxODE0Nw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MGU1ZTNjNDE3OGRhM2NjYTRjNzRhMWNhZmYwMGIzMzUxNjRlZmRkN2EyMzAz
10
- ZDZhMmNjZWM3YmZkN2VlNDFhMGZlZmQxYmNjNjlkNThjOGNhMzg1ZTMyYWQy
11
- ZjY4NTQwMzZiMjUzZWMwNzU5M2E4YWM5MGJmOWExMGY0ZDBhNTQ=
9
+ MDdkNmNmZWM5NWE2MjQ5NGNhNGNjZjc4Y2JhZDUzMTYzYjZmMTIxYWM5OTU2
10
+ Y2EwODI2YThjMGIwYWY4ZmM5MDA3YzE3OWJjMjczNDI5NDc4MTgzOWMxMWIz
11
+ NDg1NTRjNTA5NGJiNjJiN2E2NTYyNDc0YzFmMDMyNGY4Y2ZmMjc=
12
12
  data.tar.gz: !binary |-
13
- YzRkNzBkM2FiZjQzMzNkYjA3Mjk3MWM2ZTc1MDg0MGYwODRmNzUwYmExZGRm
14
- ODIxNmZiNjMyY2IzYjFhOGY0ZmU3MWRkY2M3NWIyYmVmMGZmYTQzNWIyYTg2
15
- YzJmMmRjODc3NzcxZWZkMDhhZWZhMjdjMTQ0ZWNhMTYzYzEwODA=
13
+ M2I3NWUwMWYxNTY1ZDgyMzE0MzVlZGQ2ZTU0ZjI3OWVlOWNmYjg5ODdhNzFj
14
+ NjhmNWQ5NjgyYzRjNjVkNmVmYmJiMTA0ZWNmNzhjMDJjYTAwOWYxNWFlMDQ3
15
+ MzUyYTM5MDU0NzA0MTBiMWEwODA5NDQ2MmRkZTc2Y2Y2NDU3NDk=
@@ -30,7 +30,8 @@ class TestTrack::Remote::SplitRegistry
30
30
  instance.attributes
31
31
  end.freeze
32
32
  end
33
- rescue *TestTrack::SERVER_ERRORS
33
+ rescue *TestTrack::SERVER_ERRORS => e
34
+ Rails.logger.error "TestTrack failed to load split registry. #{e}"
34
35
  nil # if we can't get a split registry
35
36
  end
36
37
  end
@@ -129,7 +129,7 @@ class TestTrack::Session
129
129
  end
130
130
 
131
131
  def sync_assignments?
132
- !visitor.offline? && visitor.unsynced_assignments.present?
132
+ visitor.loaded? && visitor.unsynced_assignments.present?
133
133
  end
134
134
 
135
135
  def mixpanel_distinct_id
@@ -17,7 +17,8 @@ class TestTrack::UnsyncedAssignmentsNotifier
17
17
  build_notify_assignment_job(assignment).tap do |job|
18
18
  begin
19
19
  job.perform
20
- rescue *TestTrack::SERVER_ERRORS
20
+ rescue *TestTrack::SERVER_ERRORS => e
21
+ Rails.logger.error "TestTrack failed to notify unsynced assignments, retrying. #{e}"
21
22
  Delayed::Job.enqueue(build_notify_assignment_job(assignment))
22
23
  end
23
24
  end
@@ -70,7 +70,9 @@ class TestTrack::Visitor
70
70
  begin
71
71
  identifier = TestTrack::Remote::Identifier.create!(identifier_opts)
72
72
  merge!(identifier.visitor)
73
- rescue *TestTrack::SERVER_ERRORS
73
+ rescue *TestTrack::SERVER_ERRORS => e
74
+ Rails.logger.error "TestTrack failed to link identifier, retrying. #{e}"
75
+
74
76
  # If at first you don't succeed, async it - we may not display 100% consistent UX this time,
75
77
  # but subsequent requests will be better off
76
78
  TestTrack::Remote::Identifier.delay.create!(identifier_opts)
@@ -92,6 +94,10 @@ class TestTrack::Visitor
92
94
  @tt_offline
93
95
  end
94
96
 
97
+ def loaded?
98
+ !offline? && @remote_visitor.present?
99
+ end
100
+
95
101
  private
96
102
 
97
103
  def assignments
@@ -100,7 +106,8 @@ class TestTrack::Visitor
100
106
 
101
107
  def remote_visitor
102
108
  @remote_visitor ||= TestTrack::Remote::Visitor.find(id) unless tt_offline?
103
- rescue *TestTrack::SERVER_ERRORS
109
+ rescue *TestTrack::SERVER_ERRORS => e
110
+ Rails.logger.error "TestTrack failed to load remote visitor. #{e}"
104
111
  @tt_offline = true
105
112
  nil
106
113
  end
@@ -14,7 +14,7 @@ require 'request_store'
14
14
  module TestTrack
15
15
  module_function
16
16
 
17
- SERVER_ERRORS = [Faraday::TimeoutError, Her::Errors::RemoteServerError].freeze
17
+ SERVER_ERRORS = [Faraday::ConnectionFailed, Faraday::TimeoutError, Her::Errors::RemoteServerError].freeze
18
18
 
19
19
  mattr_accessor :enabled_override
20
20
 
@@ -1,3 +1,3 @@
1
1
  module TestTrackRailsClient
2
- VERSION = "0.9.11" # rubocop:disable Style/MutableConstant
2
+ VERSION = "0.9.12" # rubocop:disable Style/MutableConstant
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_track_rails_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.11
4
+ version: 0.9.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan O'Neill
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2016-11-08 00:00:00.000000000 Z
16
+ date: 2016-11-28 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: rails