This commit is contained in:
wuaho 2021-08-14 09:29:46 +08:00
parent 14d1ab3f0a
commit 3ca8b92f90

View File

@ -26,17 +26,19 @@ class Transmitter:
def check_send(self):
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():
tb, buffer = h.buffer_pool
buffer_size = len(buffer)
if (p['ts'] + p['time_out'] <= ts or buffer_size >= p['bulk_max']) and buffer_size > 0:
p['ts'] = ts
yield tb, buffer
if self.ping_ts + 60 < ts:
# 保持连接
self.ping_ts = ts
print('保持连接')
self.db_client.execute('select 1')
@staticmethod
def flat_data(data: dict):