banjo-apn_sender 2.3.0 → 2.4.0

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: a634620bc1103f8cf7e5dc05cccc110f9304c58e
4
- data.tar.gz: 12caed86038b507c3d566462eb242b18e0c65585
3
+ metadata.gz: 8a66d23e5df5e3bf8ce14d1a434901309603085b
4
+ data.tar.gz: 04d6622680c2fa4d0436d97bc3756f827cdb1f29
5
5
  SHA512:
6
- metadata.gz: d7c42f2e5f6c2a5ec184223235d1f885611526c1c99c9e06057f5125346a9d0dc48d2cd83f778d9a8c4528395ba9e44cd4609079862ace44ea22bf479dcd59ee
7
- data.tar.gz: 27d2269b1aca8c496179d34456ced200560428cb7eeb8622be1ad877aec92488dfe86564b9a87dd20f7484ecc1af27b0f0d7699d64517e036a137304b296871a
6
+ metadata.gz: 00f01191ba90ef3eb1f7ff7fccb5b3a886c6ab5bf674c87682132ffcc9c331c326bc130b7ac52a91bb87d375c99740a2f0fef352796994d9ac7e1f5755604488
7
+ data.tar.gz: 66243395f85a449687a6b299fd85d1730c9f7418029f54cb30438b6eedfbc99a0d125049e41190cab0cf1d3146fc4830d80ccbdae577a777399f2843d0cabb67
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{banjo-apn_sender}
8
- s.version = "2.3.0"
8
+ s.version = "2.4.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Kali Donovan}, %q{KW Justin Leung}]
@@ -5,10 +5,11 @@ class APN::Connection
5
5
 
6
6
  @production_senders = Hash.new
7
7
  @sandbox_senders = Hash.new
8
- @enterprise_semaphore = Mutex.new
8
+ @enterprise_senders = Hash.new
9
9
 
10
10
  @production_last_accesses = Hash.new
11
11
  @sandbox_last_accesses = Hash.new
12
+ @enterprise_last_accesses = Hash.new
12
13
 
13
14
  def push_fifo(env, token)
14
15
  @fifos[env] <<= token
@@ -58,29 +59,27 @@ class APN::Connection
58
59
  epoch = Time.now.to_i
59
60
 
60
61
  # Use only 1 single thread for internal enterprise cert
61
- if enterprise && !sandbox
62
- if @enterprise_sender && (epoch - @enterprise_last_access) > IDLE_RECONNECTION_INTERVAL
63
- @enterprise_sender.reconnect
62
+ if enterprise
63
+ if @enterprise_senders[thread_id] && (epoch - @enterprise_last_accesses[thread_id]) > IDLE_RECONNECTION_INTERVAL
64
+ @enterprise_senders[thread_id].reconnect
65
+ end
66
+
67
+ @enterprise_last_accesses[thread_id] = epoch
68
+ @enterprise_senders[thread_id] ||= new(worker_count: 1, verbose: 1, enterprise: 1)
69
+ elsif sandbox
70
+ if @sandbox_senders[thread_id] && (epoch - @sandbox_last_accesses[thread_id]) > IDLE_RECONNECTION_INTERVAL
71
+ @sandbox_senders[thread_id].reconnect
64
72
  end
65
73
 
66
- @enterprise_last_access = epoch
67
- @enterprise_sender ||= new(worker_count: 1, verbose: 1, enterprise: 1)
74
+ @sandbox_last_accesses[thread_id] = epoch
75
+ @sandbox_senders[thread_id] ||= new(worker_count: 1, sandbox: 1, verbose: 1)
68
76
  else
69
- if sandbox
70
- if @sandbox_senders[thread_id] && (epoch - @sandbox_last_accesses[thread_id]) > IDLE_RECONNECTION_INTERVAL
71
- @sandbox_senders[thread_id].reconnect
72
- end
73
-
74
- @sandbox_last_accesses[thread_id] = epoch
75
- @sandbox_senders[thread_id] ||= new(worker_count: 1, sandbox: 1, verbose: 1)
76
- else
77
- if @production_senders[thread_id] && (epoch - @production_last_accesses[thread_id]) > IDLE_RECONNECTION_INTERVAL
78
- @production_senders[thread_id].reconnect
79
- end
80
-
81
- @production_last_accesses[thread_id] = epoch
82
- @production_senders[thread_id] ||= new(worker_count: 1, verbose: 1)
77
+ if @production_senders[thread_id] && (epoch - @production_last_accesses[thread_id]) > IDLE_RECONNECTION_INTERVAL
78
+ @production_senders[thread_id].reconnect
83
79
  end
80
+
81
+ @production_last_accesses[thread_id] = epoch
82
+ @production_senders[thread_id] ||= new(worker_count: 1, verbose: 1)
84
83
  end
85
84
  end
86
85
 
@@ -94,13 +93,7 @@ class APN::Connection
94
93
  tag = "#{sandbox ? 'sandbox' : 'production'}#{enterprise ? ' enterprise' : ''}"
95
94
  sender.log(:info, "token: #{token} message: #{message}, style: #{style}")
96
95
  debug = style[:debug] || (style[:debug_sample] && rand(style[:debug_sample].to_i) == 0)
97
-
98
- if enterprise
99
- @enterprise_semaphore.synchronize { sender.send_to_apple(msg, token, env, tag, debug) }
100
- else
101
- sender.send_to_apple(msg, token, env, tag, debug)
102
- end
103
-
96
+ sender.send_to_apple(msg, token, env, tag, debug)
104
97
  sender
105
98
  end
106
99
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: banjo-apn_sender
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kali Donovan