Reduce connection cpu usage by socket send time
This commit is contained in:
parent
2eb6cc8f55
commit
636813c603
1 changed files with 3 additions and 2 deletions
|
@ -82,7 +82,6 @@ class FileRequest(object):
|
||||||
func_name = "action" + cmd[0].upper() + cmd[1:]
|
func_name = "action" + cmd[0].upper() + cmd[1:]
|
||||||
func = getattr(self, func_name, None)
|
func = getattr(self, func_name, None)
|
||||||
if cmd not in ["getFile", "streamFile"]: # Skip IO bound functions
|
if cmd not in ["getFile", "streamFile"]: # Skip IO bound functions
|
||||||
s = time.time()
|
|
||||||
if self.connection.cpu_time > 0.5:
|
if self.connection.cpu_time > 0.5:
|
||||||
self.log.debug(
|
self.log.debug(
|
||||||
"Delay %s %s, cpu_time used by connection: %.3fs" %
|
"Delay %s %s, cpu_time used by connection: %.3fs" %
|
||||||
|
@ -91,6 +90,7 @@ class FileRequest(object):
|
||||||
time.sleep(self.connection.cpu_time)
|
time.sleep(self.connection.cpu_time)
|
||||||
if self.connection.cpu_time > 5:
|
if self.connection.cpu_time > 5:
|
||||||
self.connection.close("Cpu time: %.3fs" % self.connection.cpu_time)
|
self.connection.close("Cpu time: %.3fs" % self.connection.cpu_time)
|
||||||
|
s = time.time()
|
||||||
if func:
|
if func:
|
||||||
func(params)
|
func(params)
|
||||||
else:
|
else:
|
||||||
|
@ -98,7 +98,8 @@ class FileRequest(object):
|
||||||
|
|
||||||
if cmd not in ["getFile", "streamFile"]:
|
if cmd not in ["getFile", "streamFile"]:
|
||||||
taken = time.time() - s
|
taken = time.time() - s
|
||||||
self.connection.cpu_time += taken
|
taken_sent = self.connection.last_sent_time - self.connection.last_send_time
|
||||||
|
self.connection.cpu_time += taken - taken_sent
|
||||||
|
|
||||||
# Update a site file request
|
# Update a site file request
|
||||||
def actionUpdate(self, params):
|
def actionUpdate(self, params):
|
||||||
|
|
Loading…
Reference in a new issue