apple_shove 2.0.1 → 2.0.2
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 +4 -4
- data/.travis.yml +9 -0
- data/README.md +1 -1
- data/lib/apple_shove/apns/notify_connection.rb +13 -7
- data/lib/apple_shove/version.rb +1 -1
- data/spec/notification_queue_spec.rb +13 -4
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b119daa9b46ae843bed8fc8327dd77ac20189551
|
4
|
+
data.tar.gz: f2a2c0b62cc2593f5f3a1cb3a239552cd3092028
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 329d709e3ea8811764a41fe55928e3a2e48bb1a62262c920c15d3c8166c8901b2d92a3e2ec4c3bed360f92ee582b78e023804af41cf053932dbaaca3ab77e3e8
|
7
|
+
data.tar.gz: fdad094d6ff2b8519ec200e2b4066b7a2a0d5f26bfce390370c389e7bcc5d061c450b780bcbf265a174837269a7267ffa0948370e8edf26594c86fb77ac2e5a4
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# AppleShove [](https://codeclimate.com/github/tboyko/apple_shove)
|
1
|
+
# AppleShove [](https://codeclimate.com/github/tboyko/apple_shove) [](https://travis-ci.org/tboyko/apple_shove)
|
2
2
|
|
3
3
|
APN Service Provider. More powerful than a push...
|
4
4
|
|
@@ -23,7 +23,7 @@ module AppleShove
|
|
23
23
|
end
|
24
24
|
|
25
25
|
exclusive
|
26
|
-
|
26
|
+
|
27
27
|
def connect
|
28
28
|
super
|
29
29
|
@last_used = Time.now
|
@@ -42,16 +42,22 @@ module AppleShove
|
|
42
42
|
rescue Exception => e
|
43
43
|
handler = WriteExceptionHandler.new(e)
|
44
44
|
Logger.warn(handler.message, self, notification)
|
45
|
-
|
46
|
-
|
45
|
+
|
46
|
+
begin
|
47
|
+
reconnect if handler.reconnect?
|
48
|
+
socket.write @last_message if handler.rewrite? && @last_message
|
49
|
+
rescue Exception => e
|
50
|
+
Logger.warn("failed while trying to recover from write error", self, notification)
|
51
|
+
end
|
52
|
+
|
47
53
|
retry if handler.retry?
|
48
54
|
else
|
49
55
|
Logger.info("delivered notification", self, notification)
|
50
|
-
end
|
51
56
|
|
52
|
-
|
53
|
-
|
54
|
-
|
57
|
+
@last_message = message
|
58
|
+
@last_used = Time.now
|
59
|
+
@pending_notifications -= 1
|
60
|
+
end
|
55
61
|
end
|
56
62
|
|
57
63
|
def shutdown
|
data/lib/apple_shove/version.rb
CHANGED
@@ -13,21 +13,30 @@ describe AppleShove::NotificationQueue do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'should add notifications to the queue' do
|
16
|
+
expect_any_instance_of(Redis).to receive(:rpush)
|
17
|
+
|
16
18
|
n = generate_notification
|
17
19
|
@q.add(n)
|
18
20
|
end
|
19
21
|
|
20
22
|
it 'should count notification on the queue when they are there' do
|
21
|
-
|
23
|
+
expect_any_instance_of(Redis).to receive(:llen).and_return(1)
|
24
|
+
|
25
|
+
expect(@q.size).to be_a_kind_of(Integer)
|
22
26
|
end
|
23
27
|
|
24
28
|
it 'should get notifications from the queue' do
|
25
|
-
|
26
|
-
|
27
|
-
|
29
|
+
json = { p12: 'some p12', device_token: '123123123', payload: 'this is a test payload' }.to_json
|
30
|
+
expect_any_instance_of(Redis).to receive(:lpop).and_return(json)
|
31
|
+
|
32
|
+
notification = @q.get
|
33
|
+
|
34
|
+
expect(notification).to be_an_instance_of(AppleShove::Notification)
|
28
35
|
end
|
29
36
|
|
30
37
|
it 'should count 0 notifications when the queue is empty' do
|
38
|
+
expect_any_instance_of(Redis).to receive(:llen).and_return(0)
|
39
|
+
|
31
40
|
@q.size.should eql(0)
|
32
41
|
end
|
33
42
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apple_shove
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taylor Boyko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -103,6 +103,7 @@ extensions: []
|
|
103
103
|
extra_rdoc_files: []
|
104
104
|
files:
|
105
105
|
- .gitignore
|
106
|
+
- .travis.yml
|
106
107
|
- Gemfile
|
107
108
|
- LICENSE.txt
|
108
109
|
- README.md
|