splitclient-rb 7.1.4.pre.rc14-java → 7.1.4.pre.rc19-java
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90fcccf598ffb68bcd8a24572926db732d7a8597
|
4
|
+
data.tar.gz: 441fcced7138c622713e42b5405743fdd8d95a9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b73e0212db9cc59f0c77369c931418ca067e0f1c9bec0b711213adbe5aa82ad67a9a3c6e1cbec8ac4b2f8598df909d178a5f9ad9c061cc3f405fb9ab34e2fdc
|
7
|
+
data.tar.gz: c56739c82ecea3c4626cc40e7495f16660099ed7be72956f423afc0b6819f827cd8e636bb1f7974d1d2948f9f54f03343d9e9956eae6625e4df14eefeb5aa7f8
|
@@ -19,28 +19,30 @@ module SplitIoClient
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def add_bulk(impressions)
|
22
|
-
return unless @listener
|
23
22
|
impressions.each do |impression|
|
24
|
-
enqueue(
|
25
|
-
split_name: impression[:i][:f],
|
26
|
-
matching_key: impression[:i][:k],
|
27
|
-
bucketing_key: impression[:i][:b],
|
28
|
-
time: impression[:i][:m],
|
29
|
-
treatment: {
|
30
|
-
label: impression[:i][:r],
|
31
|
-
treatment: impression[:i][:t],
|
32
|
-
change_number: impression[:i][:c]
|
33
|
-
},
|
34
|
-
previous_time: impression[:i][:pt],
|
35
|
-
attributes: impression[:attributes]
|
36
|
-
) unless impression.nil?
|
23
|
+
enqueue(impression)
|
37
24
|
end
|
38
25
|
end
|
39
26
|
|
40
27
|
private
|
41
28
|
|
42
29
|
def enqueue(impression)
|
43
|
-
|
30
|
+
imp = {
|
31
|
+
split_name: impression[:i][:f],
|
32
|
+
matching_key: impression[:i][:k],
|
33
|
+
bucketing_key: impression[:i][:b],
|
34
|
+
time: impression[:i][:m],
|
35
|
+
treatment: {
|
36
|
+
label: impression[:i][:r],
|
37
|
+
treatment: impression[:i][:t],
|
38
|
+
change_number: impression[:i][:c]
|
39
|
+
},
|
40
|
+
previous_time: impression[:i][:pt],
|
41
|
+
attributes: impression[:attributes]
|
42
|
+
}
|
43
|
+
@queue.push(imp) if @listener
|
44
|
+
rescue StandardError => error
|
45
|
+
@config.log_found_exception(__method__.to_s, error)
|
44
46
|
end
|
45
47
|
|
46
48
|
def router_thread
|
@@ -32,12 +32,12 @@ module SplitIoClient
|
|
32
32
|
to_return
|
33
33
|
end
|
34
34
|
|
35
|
-
def
|
36
|
-
|
35
|
+
def make_key(split_name, time_frame)
|
36
|
+
"#{split_name}::#{ImpressionCounter.truncate_time_frame(time_frame)}"
|
37
37
|
end
|
38
38
|
|
39
|
-
def
|
40
|
-
|
39
|
+
def self.truncate_time_frame(timestamp_ms)
|
40
|
+
timestamp_ms - (timestamp_ms % TIME_INTERVAL_MS)
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
@@ -8,7 +8,6 @@ module SplitIoClient
|
|
8
8
|
@config = config
|
9
9
|
@impressions_repository = impressions_repository
|
10
10
|
@impression_counter = impression_counter
|
11
|
-
@impression_router = SplitIoClient::ImpressionRouter.new(@config)
|
12
11
|
@impression_observer = SplitIoClient::Observers::ImpressionObserver.new
|
13
12
|
end
|
14
13
|
|
@@ -18,7 +17,7 @@ module SplitIoClient
|
|
18
17
|
|
19
18
|
impression_data[:pt] = @impression_observer.test_and_set(impression_data) unless redis?
|
20
19
|
|
21
|
-
|
20
|
+
@impression_counter.inc(split_name, impression_data[:m]) if optimized? && !redis?
|
22
21
|
|
23
22
|
impression(impression_data, params[:attributes])
|
24
23
|
rescue StandardError => error
|
@@ -28,8 +27,14 @@ module SplitIoClient
|
|
28
27
|
def track(impressions)
|
29
28
|
return if impressions.empty?
|
30
29
|
|
31
|
-
|
32
|
-
|
30
|
+
impression_router.add_bulk(impressions)
|
31
|
+
|
32
|
+
if optimized? && !redis?
|
33
|
+
optimized_impressions = impressions.select { |imp| should_queue_impression?(imp[:i]) }
|
34
|
+
@impressions_repository.add_bulk(optimized_impressions)
|
35
|
+
else
|
36
|
+
@impressions_repository.add_bulk(impressions)
|
37
|
+
end
|
33
38
|
rescue StandardError => error
|
34
39
|
@config.log_found_exception(__method__.to_s, error)
|
35
40
|
end
|
@@ -66,14 +71,9 @@ module SplitIoClient
|
|
66
71
|
@config.impressions_mode == :optimized
|
67
72
|
end
|
68
73
|
|
69
|
-
def impression_optimized(split_name, impression_data, attributes)
|
70
|
-
@impression_counter.inc(split_name, impression_data[:m])
|
71
|
-
|
72
|
-
impression(impression_data, attributes) if should_queue_impression?(impression_data)
|
73
|
-
end
|
74
|
-
|
75
74
|
def should_queue_impression?(impression)
|
76
|
-
impression[:pt].nil? ||
|
75
|
+
impression[:pt].nil? ||
|
76
|
+
(ImpressionCounter.truncate_time_frame(impression[:pt]) != ImpressionCounter.truncate_time_frame(impression[:m]))
|
77
77
|
end
|
78
78
|
|
79
79
|
def impression(impression_data, attributes)
|
@@ -83,6 +83,12 @@ module SplitIoClient
|
|
83
83
|
def redis?
|
84
84
|
@config.impressions_adapter.class.to_s == 'SplitIoClient::Cache::Adapters::RedisAdapter'
|
85
85
|
end
|
86
|
+
|
87
|
+
def impression_router
|
88
|
+
@impression_router ||= SplitIoClient::ImpressionRouter.new(@config)
|
89
|
+
rescue StandardError => error
|
90
|
+
@config.log_found_exception(__method__.to_s, error)
|
91
|
+
end
|
86
92
|
end
|
87
93
|
end
|
88
94
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: splitclient-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.1.4.pre.
|
4
|
+
version: 7.1.4.pre.rc19
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Split Software
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|