sentia_apn_sender 1.0.4 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/apn.rb +2 -1
- data/lib/apn/before_unregister_worker_support.rb +14 -0
- data/lib/apn/queue_manager.rb +1 -9
- data/lib/resque/hooks/before_unregister_worker.rb +1 -16
- data/sentia_apn_sender.gemspec +2 -1
- metadata +6 -5
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.6
|
data/lib/apn.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'resque'
|
2
|
+
require 'apn/before_unregister_worker_support'
|
2
3
|
require 'resque/plugins/access_worker_from_job'
|
3
4
|
require 'resque/hooks/before_unregister_worker'
|
4
5
|
require 'json'
|
@@ -10,4 +11,4 @@ require 'apn/notification'
|
|
10
11
|
require 'apn/notification_job'
|
11
12
|
require 'apn/connection/base'
|
12
13
|
require 'apn/sender'
|
13
|
-
require 'apn/feedback'
|
14
|
+
require 'apn/feedback'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module APN
|
2
|
+
module BeforeUnregisterSupport
|
3
|
+
def before_unregister_worker(&block)
|
4
|
+
block ? (@before_unregister_worker = block) : @before_unregister_worker
|
5
|
+
end
|
6
|
+
|
7
|
+
def before_unregister_worker=(before_unregister_worker)
|
8
|
+
@before_unregister_worker = before_unregister_worker
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# Add this module to the base Resque class
|
14
|
+
Resque.send(:extend, APN::BeforeUnregisterSupport)
|
data/lib/apn/queue_manager.rb
CHANGED
@@ -13,14 +13,7 @@ module APN
|
|
13
13
|
# functionality in the parent app, if we're included in e.g. a Rails application.
|
14
14
|
class QueueManager
|
15
15
|
extend Resque
|
16
|
-
|
17
|
-
def self.before_unregister_worker(&block)
|
18
|
-
block ? (@before_unregister_worker = block) : @before_unregister_worker
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.before_unregister_worker=(before_unregister_worker)
|
22
|
-
@before_unregister_worker = before_unregister_worker
|
23
|
-
end
|
16
|
+
extend BeforeUnregisterSupport
|
24
17
|
|
25
18
|
def self.to_s
|
26
19
|
"APN::QueueManager (Resque Client) connected to #{redis.server}"
|
@@ -43,7 +36,6 @@ APN::QueueManager.before_unregister_worker do |worker|
|
|
43
36
|
worker.send(:teardown_connection) if worker.respond_to?(:teardown_connection)
|
44
37
|
end
|
45
38
|
|
46
|
-
|
47
39
|
# # Run N jobs per fork, rather than creating a new fork for each notification
|
48
40
|
# # By defunkt - http://gist.github.com/349376
|
49
41
|
# APN::QueueManager.after_fork do |job|
|
@@ -11,20 +11,5 @@ module Resque
|
|
11
11
|
run_hook(:before_unregister_worker, self)
|
12
12
|
unregister_worker_without_before_hook
|
13
13
|
end
|
14
|
-
|
15
|
-
|
16
|
-
# Unforunately have to override Resque::Worker's +run_hook+ method to call hook on
|
17
|
-
# APN::QueueManager rather on Resque directly. Any suggestions on
|
18
|
-
# how to make this more flexible are more than welcome.
|
19
|
-
def run_hook(name, *args)
|
20
|
-
# return unless hook = Resque.send(name)
|
21
|
-
return unless hook = APN::QueueManager.send(name)
|
22
|
-
msg = "Running #{name} hook"
|
23
|
-
msg << " with #{args.inspect}" if args.any?
|
24
|
-
log msg
|
25
|
-
|
26
|
-
args.any? ? hook.call(*args) : hook.call
|
27
|
-
end
|
28
|
-
|
29
14
|
end
|
30
|
-
end
|
15
|
+
end
|
data/sentia_apn_sender.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "sentia_apn_sender"
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kali Donovan", "Mario Visic"]
|
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
"init.rb",
|
29
29
|
"lib/apn.rb",
|
30
30
|
"lib/apn/connection/base.rb",
|
31
|
+
"lib/apn/before_unregister_worker_support.rb",
|
31
32
|
"lib/apn/feedback.rb",
|
32
33
|
"lib/apn/notification.rb",
|
33
34
|
"lib/apn/notification_job.rb",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sentia_apn_sender
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,7 +14,7 @@ date: 2012-05-04 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: resque
|
17
|
-
requirement: &
|
17
|
+
requirement: &70294224336180 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70294224336180
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: resque-access_worker_from_job
|
28
|
-
requirement: &
|
28
|
+
requirement: &70294224335600 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70294224335600
|
37
37
|
description: Resque-based background worker to send Apple Push Notifications over
|
38
38
|
a persistent TCP socket. Includes Resque tweaks to allow persistent sockets between
|
39
39
|
jobs, helper methods for enqueueing APN notifications, and a background daemon to
|
@@ -56,6 +56,7 @@ files:
|
|
56
56
|
- init.rb
|
57
57
|
- lib/apn.rb
|
58
58
|
- lib/apn/connection/base.rb
|
59
|
+
- lib/apn/before_unregister_worker_support.rb
|
59
60
|
- lib/apn/feedback.rb
|
60
61
|
- lib/apn/notification.rb
|
61
62
|
- lib/apn/notification_job.rb
|