@@ -21,7 +21,12 @@ class Log2Twisted(logging.StreamHandler):
2121 """
2222 def __init__ (self ):
2323 super (Log2Twisted ,self ).__init__ (stream = self )
24- self .write = log .msg
24+ # The Twisted log publisher adds a newline, so strip the newline added by the Python log handler.
25+ if sys .version_info < (3 ,2 ):
26+ self .write = lambda * args , ** kwargs : log .msg (* [ str (a ).strip () for a in args ], ** kwargs )
27+ else :
28+ self .terminator = "" # the 'terminator' attribute was added to StreamHandler in Python v3.2
29+ self .write = log .msg
2530 def flush (self ):
2631 pass
2732
@@ -33,6 +38,7 @@ def __init__(self, config):
3338 self .annperiod = float (config .get ('announceInterval' , '15.0' ))
3439 self .tcptimeout = float (config .get ('tcptimeout' , '15.0' ))
3540 self .commitperiod = float (config .get ('commitInterval' , '5.0' ))
41+ self .commitSizeLimit = int (config .get ('commitSizeLimit' , '0' ))
3642 self .maxActive = int (config .get ('maxActive' , '20' ))
3743 self .bind , _sep , portn = config .get ('bind' , '' ).strip ().partition (':' )
3844 self .addrlist = []
@@ -65,6 +71,7 @@ def privilegedStartService(self):
6571 self .tcpFactory = CastFactory ()
6672 self .tcpFactory .protocol .timeout = self .tcptimeout
6773 self .tcpFactory .session .timeout = self .commitperiod
74+ self .tcpFactory .session .trlimit = self .commitSizeLimit
6875 self .tcpFactory .maxActive = self .maxActive
6976
7077 # Attaching CastFactory to ProcessorController
0 commit comments