alephant-broker 1.2.0 → 1.2.1
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: 7188ad7416429b9e3644497b893e54d17cf18848
|
4
|
+
data.tar.gz: 600553f7caaceb30285b9454192211cdc8b49773
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e880ac06f905b8d4e56b4ec9e25f601d2c0996bcd37321a25d3779c951139ab08c150499e6c5f688fa35505150b04cc7378e769c3ee6d7ea2ea8a7bb0595c4a3
|
7
|
+
data.tar.gz: 93191cbd238306a803f607520522d2ee02018c36fdb9d4e8c5435a2fed4a050a24ebb566a97e84a45cd1b4d834847ace817087f51ac6b6df2d9ba3096599a984
|
data/lib/alephant/broker.rb
CHANGED
@@ -54,6 +54,7 @@ module Alephant
|
|
54
54
|
response.status,
|
55
55
|
{
|
56
56
|
"Content-Type" => response.content_type,
|
57
|
+
"X-Sequence" => response.sequence.to_s,
|
57
58
|
"X-Version" => response.version.to_s,
|
58
59
|
"X-Cached" => response.cached.to_s
|
59
60
|
}.merge(response.headers),
|
@@ -65,10 +66,11 @@ module Alephant
|
|
65
66
|
|
66
67
|
def stop_poll_response
|
67
68
|
response = OpenStruct.new(
|
68
|
-
:status
|
69
|
-
:content
|
70
|
-
:cached
|
71
|
-
:version
|
69
|
+
:status => 420,
|
70
|
+
:content => "Stopped polling",
|
71
|
+
:cached => false,
|
72
|
+
:version => 0,
|
73
|
+
:sequence => 0,
|
72
74
|
:headers => {
|
73
75
|
"Content-Type" => "plain/text",
|
74
76
|
"X-Cached" => "false",
|
@@ -20,7 +20,7 @@ module Alephant
|
|
20
20
|
@content = loaded_content[:body]
|
21
21
|
@content_type = loaded_content[:content_type]
|
22
22
|
@status = loaded_content[:status]
|
23
|
-
@
|
23
|
+
@sequence = component.version.nil? ? 'not available' : component.version
|
24
24
|
@cached = component.cached
|
25
25
|
end
|
26
26
|
|
@@ -6,7 +6,7 @@ module Alephant
|
|
6
6
|
module Response
|
7
7
|
class Base
|
8
8
|
attr_reader :headers
|
9
|
-
attr_accessor :status, :content, :content_type, :version, :cached
|
9
|
+
attr_accessor :status, :content, :content_type, :version, :sequence, :cached
|
10
10
|
|
11
11
|
STATUS_CODE_MAPPING = {
|
12
12
|
200 => 'ok',
|
@@ -16,7 +16,8 @@ module Alephant
|
|
16
16
|
|
17
17
|
def initialize(status = 200, content_type = "text/html")
|
18
18
|
@headers = {}
|
19
|
-
@
|
19
|
+
@sequence = 'not available'
|
20
|
+
@version = Broker.config.fetch('elasticache_cache_version', 'not available').to_s
|
20
21
|
@cached = false
|
21
22
|
@content_type = content_type
|
22
23
|
@status = status
|
@@ -31,6 +32,7 @@ module Alephant
|
|
31
32
|
:content => @content,
|
32
33
|
:content_type => @content_type,
|
33
34
|
:version => @version,
|
35
|
+
:sequence => @sequence,
|
34
36
|
:cached => @cached
|
35
37
|
}
|
36
38
|
end
|