powertrack 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NjZjMjc0OWE1ODU4NTUyNTY2Zjk1YzdiMjYxZDgxMjYwMTI0MmQyMg==
4
+ NTU5ZmE5N2E3YTQxMTc1ZTg2N2RjMmJmMDRhMWRkMzYzNjcxNGYzMg==
5
5
  data.tar.gz: !binary |-
6
- MmEzNDQ0YWYzZGYwODcwNDM0MDU5MDc1YjdlZTIwMTRjMmRhNzZlYQ==
6
+ NWI4ZjlmZjQ0NGIyYTYzMjkzMGIyOTkwNzU3N2QxNzFiMzQ3NmEyZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NTU5ZmE3MzI3NzUzYTYxYzgyNGZiYzBkYjllODdiMTA5M2YyYWIyN2Y3M2E2
10
- M2ZhNDRmZWFlNTE1ZTI4YTA0OGZiNDg4NDFiYWQwOWRiNGMwNjhlMTIzZWRi
11
- NGNhNzFiZTIyM2Q3Y2I4OTUzYmQ0ZmRmYjQ4ODRiODhkMjUzMzg=
9
+ MmFkZDBjODJjZGQxMzZjNGEwYTA5NTc4NTIwZjEzOWQ5MzE3YzAyMTc2MjY3
10
+ ZDg1YjA1ZjI3ZmEyYTIzMzU1OTY3NzU1YmE2ZGVhNDc2YWNiNjk1YzkwZTEx
11
+ M2NmMWVlNWJiZjFkNzMzMDUyODA2YzBkMjRkZjY4NGU4OTUzZjk=
12
12
  data.tar.gz: !binary |-
13
- YzQxZjcxMDVmYTQzZmRlODNjMWIyNmNlNDczNWUyMTQzNzM5MmRlZDk2ZDJh
14
- ZDhkNmU3MzRmMTFiZjBlM2RiZjYzZmQ4MzQ1MjI1YThjZGVmYjdjMWZjZTI0
15
- OGUxYzYwY2JlY2Q3NDMwOWQ1N2NlMjg1MDI1ZjU2NzU5NGQzOGE=
13
+ YzE5NjQwMWNlOTg0Y2RmNDZkYmU5ZjZhYTkwZDQxZTE5MWI4NjZmNWJjZTVk
14
+ M2Q3ZDY5MGZjMTliN2U0ZjNkZWUxYjdkYmU4MTg3NDQwNDcwNTUyY2VmNzNh
15
+ Y2U0Y2E1MDhjNzcxM2NiMDg5MzYwNjZmNDk4YmRmNDdlZTRjZmI=
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- powertrack (1.1.0)
4
+ powertrack (1.1.1)
5
5
  em-http-request (~> 1.1)
6
6
  eventmachine (~> 1.0)
7
7
  exponential-backoff (~> 0.0.2)
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ v1.1.1
2
+ ------
3
+
4
+ * Support retries in Replay mode
5
+
1
6
  v1.1.0
2
7
  ------
3
8
 
data/README.md CHANGED
@@ -84,7 +84,7 @@ It's up to the developer's responsibility to complete message processing as soon
84
84
  possible. After 10 seconds (by default), the stop will be forced and a few messages
85
85
  already received but not processed yet may be lost.
86
86
 
87
- The ```:stop_timeout``` may be fine-tune when passing options to the tracker.
87
+ The ```:stop_timeout``` may be fine-tuned when passing options to the tracker.
88
88
 
89
89
  ## Disconnections and Retries
90
90
 
@@ -93,6 +93,9 @@ backoff retry mechanism when a disconnection happens. The reconnections can be
93
93
  fine-tuned through the ```:max_retries``` and ```:backoff``` options passed to
94
94
  the ```track``` call.
95
95
 
96
+ Note that the retries counter is reset each time the client manages to receive
97
+ a message after a disconnection except in Replay mode (see further).
98
+
96
99
  ## Backfill
97
100
 
98
101
  Backfill is a feature provided by GNIP to avoid losing activities when being
@@ -112,9 +115,14 @@ object.
112
115
  Once Replay is activated, you use the stream as previously, starting by
113
116
  configuring some rules that define which activities you will recover. Once done,
114
117
  you can track the stream by specifying a timeframe with the ```:from```
115
- and ```:to options```. By default, replay happens over 30 minutes, starting 1
118
+ and ```:to``` options. By default, replay happens over 30 minutes, starting 1
116
119
  hour ago.
117
120
 
121
+ Regarding Replay mode and ```:max_retries```, the client does not reset the
122
+ retry counter and will never reconnect more than the max number of retries
123
+ specified. This specific retry behavior in Replay mode prevents the client from
124
+ replaying the same timeframe again and again when GNIP is unstable.
125
+
118
126
  ## Errors
119
127
 
120
128
  All the errors that come from PowerTrack are defined through an ad-hoc exception
@@ -391,8 +391,10 @@ module PowerTrack
391
391
  # get the message type and its (optional) level
392
392
  m_type, m_level = message_type(raw)
393
393
 
394
- # reset retries when some (valid) data are received
395
- if retrier.retrying? && m_level != :error
394
+ # reset retries when some (valid) data are received but not in replay
395
+ # mode where we don't want to retry on the same timeframe again and
396
+ # again when GNIP periodically fails
397
+ if !@replay && retrier.retrying? && m_level != :error
396
398
  logger.info "Resetting retries..."
397
399
  retrier.reset!
398
400
  end
@@ -423,7 +425,10 @@ module PowerTrack
423
425
  logger.info "Disconnected after #{retrier.retries} retries"
424
426
  disconnected = true
425
427
 
426
- if closed
428
+ resp_status = http_client.response_header.status
429
+
430
+ # stop the stream if required so or the replay is simply over
431
+ if closed || (@replay && resp_status == DEFAULT_OK_RESPONSE_STATUS)
427
432
  # close immediately if required
428
433
  wait_til_defers_finish_and_stop(stop_timeout)
429
434
  # tell the retrier the tracking is over
@@ -432,7 +437,7 @@ module PowerTrack
432
437
  # cancel the periodic close watcher
433
438
  close_watcher.cancel
434
439
 
435
- resp_status = http_client.response_header.status || DEFAULT_OK_RESPONSE_STATUS
440
+ resp_status ||= DEFAULT_OK_RESPONSE_STATUS
436
441
  resp_error = http_client.error
437
442
  resp_body = http_client.response
438
443
 
@@ -1,3 +1,3 @@
1
1
  module PowerTrack
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
@@ -71,7 +71,7 @@ class TestTrackStream < Minitest::Test
71
71
  on_activity: on_activity,
72
72
  on_system: on_system,
73
73
  close_now: close_now,
74
- max_retries: replay ? 0 : 2,
74
+ max_retries: 2,
75
75
  fake_disconnections: replay ? nil : 20,
76
76
  from: from,
77
77
  to: to)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: powertrack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Laurent Farcy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-07-05 00:00:00.000000000 Z
13
+ date: 2016-07-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler