powertrack 1.1.0 → 1.1.1
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 +8 -8
- data/Gemfile.lock +1 -1
- data/History.txt +5 -0
- data/README.md +10 -2
- data/lib/powertrack/streaming/stream.rb +9 -4
- data/lib/powertrack/version.rb +1 -1
- data/test/test_track_stream.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NTU5ZmE5N2E3YTQxMTc1ZTg2N2RjMmJmMDRhMWRkMzYzNjcxNGYzMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NWI4ZjlmZjQ0NGIyYTYzMjkzMGIyOTkwNzU3N2QxNzFiMzQ3NmEyZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MmFkZDBjODJjZGQxMzZjNGEwYTA5NTc4NTIwZjEzOWQ5MzE3YzAyMTc2MjY3
|
10
|
+
ZDg1YjA1ZjI3ZmEyYTIzMzU1OTY3NzU1YmE2ZGVhNDc2YWNiNjk1YzkwZTEx
|
11
|
+
M2NmMWVlNWJiZjFkNzMzMDUyODA2YzBkMjRkZjY4NGU4OTUzZjk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YzE5NjQwMWNlOTg0Y2RmNDZkYmU5ZjZhYTkwZDQxZTE5MWI4NjZmNWJjZTVk
|
14
|
+
M2Q3ZDY5MGZjMTliN2U0ZjNkZWUxYjdkYmU4MTg3NDQwNDcwNTUyY2VmNzNh
|
15
|
+
Y2U0Y2E1MDhjNzcxM2NiMDg5MzYwNjZmNDk4YmRmNDdlZTRjZmI=
|
data/Gemfile.lock
CHANGED
data/History.txt
CHANGED
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-
|
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
|
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
|
-
|
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
|
-
|
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
|
440
|
+
resp_status ||= DEFAULT_OK_RESPONSE_STATUS
|
436
441
|
resp_error = http_client.error
|
437
442
|
resp_body = http_client.response
|
438
443
|
|
data/lib/powertrack/version.rb
CHANGED
data/test/test_track_stream.rb
CHANGED
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.
|
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-
|
13
|
+
date: 2016-07-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|