Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

use global event handlers properly in client.py

  • Loading branch information...
commit 0e6f9376ee90a1d1d7f402705da50800150f302a 1 parent 0c8b640
Michael Leinartas mleinart authored

Showing 1 changed file with 4 additions and 7 deletions. Show diff stats Hide diff stats

  1. +4 7 lib/carbon/client.py
11 lib/carbon/client.py
@@ -5,7 +5,7 @@
5 5 from twisted.protocols.basic import Int32StringReceiver
6 6 from carbon.conf import settings
7 7 from carbon.util import pickle
8   -from carbon import log, state, events, instrumentation
  8 +from carbon import log, state, instrumentation
9 9
10 10
11 11 SEND_QUEUE_LOW_WATERMARK = settings.MAX_QUEUE_SIZE * 0.8
@@ -73,11 +73,6 @@ def sendQueued(self):
73 73 queueSize < SEND_QUEUE_LOW_WATERMARK):
74 74 self.factory.queueHasSpace.callback(queueSize)
75 75
76   - if (settings.USE_FLOW_CONTROL and
77   - state.metricReceiversPaused):
78   - log.clients('%s resuming paused clients' % self)
79   - events.resumeReceivingMetrics()
80   -
81 76 def __str__(self):
82 77 return 'CarbonClientProtocol(%s:%d:%s)' % (self.factory.destination)
83 78 __repr__ = __str__
@@ -109,13 +104,15 @@ def __init__(self, destination):
109 104 self.queuedUntilConnected = 'destinations.%s.queuedUntilConnected' % self.destinationName
110 105
111 106 def queueFullCallback(self, result):
  107 + state.events.cacheFull()
112 108 log.clients('%s send queue is full (%d datapoints)' % (self, result))
113   -
  109 +
114 110 def queueSpaceCallback(self, result):
115 111 if self.queueFull.called:
116 112 log.clients('%s send queue has space available' % self.connectedProtocol)
117 113 self.queueFull = Deferred()
118 114 self.queueFull.addCallback(self.queueFullCallback)
  115 + state.events.cacheSpaceAvailable()
119 116 self.queueHasSpace = Deferred()
120 117 self.queueHasSpace.addCallback(self.queueSpaceCallback)
121 118

0 comments on commit 0e6f937

Please sign in to comment.
Something went wrong with that request. Please try again.