maia 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/maia/messenger.rb +10 -5
- data/lib/maia/version.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
|
+
NjQwZjhhYTUxZDIyODAzZmFmOGIwMWQ1Mjc5MTc2NWYxOTYyZjI4OQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MTYzNmRiZDJmNmI2NjJjZDMzNGVjZmJjN2I1OGMxMzc4ZmUzNTdhYw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Zjk0YWZiZTQzMzBlNWY4MzQxMTY0NGE5YjdiMzg2MWI1NjFiMTNkOGU5YjEz
|
10
|
+
OWU2NTUyYWY2YzY4Y2Y2MGYxM2RjMjA3OWI0YmMzMTBkZDMyNDk5NTYzNmI3
|
11
|
+
NjA5MDhhZWEyMDc2NDA5YjA2ZDgyZTE5ZjNiMDY3Y2E0M2I5ODA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OWYxMzI0ZmYwYjhiZmE5NGI5MjAwYjNlZDk0NTc0YmQwMjNhMTk0ZWUxNTMy
|
14
|
+
MTYwNjE4MDIzNzZkZDBiMGQwYmMzZDczYjg4MWE0ZTE5ZGIyMzAwNDQ3ZDAw
|
15
|
+
YWEyZGIyOTQ2N2U3NTdiYTU1NTg3YWQ1MzZiMTEyNjQxYWRmMmY=
|
data/lib/maia/messenger.rb
CHANGED
@@ -30,10 +30,11 @@ module Maia
|
|
30
30
|
def handle_failed_tokens(results)
|
31
31
|
results.each do |result|
|
32
32
|
device = Maia::Device.find_by(token: result.token)
|
33
|
-
|
34
|
-
|
35
|
-
logger.info "Invalid token #{device.token} - destroying device #{device.id}."
|
33
|
+
if device && device_unrecoverable?(result.error)
|
34
|
+
log_error "Destroying device #{device.id}", result, device
|
36
35
|
device.destroy
|
36
|
+
else
|
37
|
+
log_error "Push to device #{device.id} failed", result, device
|
37
38
|
end
|
38
39
|
end
|
39
40
|
end
|
@@ -50,12 +51,16 @@ module Maia
|
|
50
51
|
end
|
51
52
|
end
|
52
53
|
|
53
|
-
def
|
54
|
-
error =~ /InvalidRegistration|NotRegistered/
|
54
|
+
def device_unrecoverable?(error)
|
55
|
+
error =~ /InvalidRegistration|NotRegistered|MismatchSenderId/
|
55
56
|
end
|
56
57
|
|
57
58
|
def user_already_has_token_registered?(user, token)
|
58
59
|
user.devices.exists? token: token
|
59
60
|
end
|
61
|
+
|
62
|
+
def log_error(message, result, device)
|
63
|
+
logger.info "#{message} (error: #{result.error}, token: #{device.token})"
|
64
|
+
end
|
60
65
|
end
|
61
66
|
end
|
data/lib/maia/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Logan Serman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08
|
11
|
+
date: 2016-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|