notifiable-core 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/notifiable/notifier_base.rb +10 -7
- data/lib/notifiable/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9056aaabe8cf5a4320058e83b7653887d248d7bbe16d6e27615d448d11c0096e
|
4
|
+
data.tar.gz: cb16692c30b41e7ca0be966167b9d6dee075418d410b647ea1efc60392df9f65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 883ec9596867c2b14479a49bf35770252364d924477ecedb90215df434c856b2ff4f393feb648d5d65198cc2555f30749cb707986da0df602c5ea72e9bd3322b
|
7
|
+
data.tar.gz: 8f73f02e2e78e8bb769c7ce17e6d899f7c305d62775124a8e49b72e924fb5412c025f4d1e6b7aafa212ddcbc94f045bb2ee88ae4f88148f4c54da812e14ce635
|
@@ -17,6 +17,7 @@ module Notifiable
|
|
17
17
|
|
18
18
|
def initialize(notification)
|
19
19
|
@notification = notification
|
20
|
+
@mutex = Mutex.new
|
20
21
|
end
|
21
22
|
|
22
23
|
def send_notification(device_token)
|
@@ -42,14 +43,16 @@ module Notifiable
|
|
42
43
|
def flush; end
|
43
44
|
|
44
45
|
def processed(device_token, status = NotificationStatus::SENT_STATUS, error_code = nil, error_message = nil)
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
@mutex.synchronize {
|
47
|
+
if @notification.app.save_notification_statuses
|
48
|
+
receipts << { notification_id: notification.id, device_token_id: device_token.id, status: status, created_at: DateTime.now, error_code: error_code, error_message: error_message }
|
49
|
+
save_receipts if receipts.count >= Notifiable.notification_status_batch_size
|
50
|
+
end
|
49
51
|
|
50
|
-
|
51
|
-
|
52
|
-
|
52
|
+
@notification.increment(:sent_count)
|
53
|
+
@notification.increment(:gateway_accepted_count) if status == NotificationStatus::SENT_STATUS
|
54
|
+
@notification.save if @notification.sent_count % Notifiable.notification_status_batch_size == 0
|
55
|
+
}
|
53
56
|
end
|
54
57
|
|
55
58
|
private
|
data/lib/notifiable/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notifiable-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Brooke-Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|