1
This commit is contained in:
parent
14d1ab3f0a
commit
3ca8b92f90
@ -26,17 +26,19 @@ class Transmitter:
|
|||||||
|
|
||||||
def check_send(self):
|
def check_send(self):
|
||||||
ts = int(time.time())
|
ts = int(time.time())
|
||||||
|
if self.ping_ts + 60 < ts:
|
||||||
|
# 保持连接
|
||||||
|
self.ping_ts = ts
|
||||||
|
print('保持连接')
|
||||||
|
self.db_client.execute('select 1')
|
||||||
|
|
||||||
for h, p in self.slots.items():
|
for h, p in self.slots.items():
|
||||||
tb, buffer = h.buffer_pool
|
tb, buffer = h.buffer_pool
|
||||||
buffer_size = len(buffer)
|
buffer_size = len(buffer)
|
||||||
if (p['ts'] + p['time_out'] <= ts or buffer_size >= p['bulk_max']) and buffer_size > 0:
|
if (p['ts'] + p['time_out'] <= ts or buffer_size >= p['bulk_max']) and buffer_size > 0:
|
||||||
p['ts'] = ts
|
p['ts'] = ts
|
||||||
yield tb, buffer
|
yield tb, buffer
|
||||||
if self.ping_ts + 60 < ts:
|
|
||||||
# 保持连接
|
|
||||||
self.ping_ts = ts
|
|
||||||
print('保持连接')
|
|
||||||
self.db_client.execute('select 1')
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def flat_data(data: dict):
|
def flat_data(data: dict):
|
||||||
|
Loading…
Reference in New Issue
Block a user