Browse files

applied math update to provide correct deliverability statistics.

  • Loading branch information...
1 parent ef30815 commit 033ac15f9d28da3769ff3b6d84d7f460f49c3e71 @stephenlb stephenlb committed Jun 30, 2012
Showing with 22 additions and 31 deletions.
  1. +11 −16 python-tornado/tests/delivery.py
  2. +11 −15 python-twisted/tests/delivery.py
View
27 python-tornado/tests/delivery.py
@@ -26,7 +26,6 @@
cipher_key = len(sys.argv) > 4 and sys.argv[4] or 'demo'
ssl_on = len(sys.argv) > 5 and bool(sys.argv[5]) or False
origin = len(sys.argv) > 6 and sys.argv[6] or 'pubsub.pubnub.com'
-origin = '184.72.9.220'
## -----------------------------------------------------------------------
## Analytics
@@ -74,12 +73,15 @@ def publish_sent(info = None):
pubnub.timeout( send, 0.1 )
def send():
- if analytics['queued'] < 100:
- pubnub.publish({
- 'channel' : channel,
- 'callback' : publish_sent,
- 'message' : "1234567890"
- })
+ if analytics['queued'] > 100:
+ analytics['queued'] -= 10
+ return pubnub.timeout( send, 10 )
+
+ pubnub.publish({
+ 'channel' : channel,
+ 'callback' : publish_sent,
+ 'message' : "1234567890"
+ })
def received(message):
analytics['queued'] -= 1
@@ -108,21 +110,14 @@ def show_status():
## Update Failed Deliveries
analytics['failed_deliveries'] = \
analytics['successful_publishes'] \
- - analytics['received'] \
- + analytics['queued'] \
- + analytics['failed_publishes']
+ - analytics['received']
## Update Deliverability
analytics['deliverability'] = (
float(analytics['received']) / \
- float(analytics['publishes'] or 1.0)
+ float(analytics['successful_publishes'] or 1.0)
) * 100.0
- """
- if analytics['deliverability'] > 100.0:
- analytics['deliverability'] = 100.0
- """
-
## Print Display
print( (
"max:%(max)03d/sec " + \
View
26 python-twisted/tests/delivery.py
@@ -74,12 +74,15 @@ def publish_sent(info = None):
pubnub.timeout( send, 0.1 )
def send():
- if analytics['queued'] < 100:
- pubnub.publish({
- 'channel' : channel,
- 'callback' : publish_sent,
- 'message' : "1234567890"
- })
+ if analytics['queued'] > 100:
+ analytics['queued'] -= 10
+ return pubnub.timeout( send, 10 )
+
+ pubnub.publish({
+ 'channel' : channel,
+ 'callback' : publish_sent,
+ 'message' : "1234567890"
+ })
def received(message):
analytics['queued'] -= 1
@@ -108,21 +111,14 @@ def show_status():
## Update Failed Deliveries
analytics['failed_deliveries'] = \
analytics['successful_publishes'] \
- - analytics['received'] \
- + analytics['queued'] \
- + analytics['failed_publishes']
+ - analytics['received']
## Update Deliverability
analytics['deliverability'] = (
float(analytics['received']) / \
- float(analytics['publishes'] or 1.0)
+ float(analytics['successful_publishes'] or 1.0)
) * 100.0
- """
- if analytics['deliverability'] > 100.0:
- analytics['deliverability'] = 100.0
- """
-
## Print Display
print( (
"max:%(max)03d/sec " + \

0 comments on commit 033ac15

Please sign in to comment.