ck 断开重连
This commit is contained in:
parent
3df9a6fb5c
commit
f0501b0615
3
ck/ck.py
3
ck/ck.py
@ -35,6 +35,9 @@ class CK:
|
||||
self.bulk_max = bulk_max
|
||||
self.__send_ts = int(time.time())
|
||||
|
||||
def set_connect(self, client):
|
||||
self.client = client
|
||||
|
||||
def up_tb_struct(self, db, tb, data):
|
||||
struct_dict = self.struct_dict.get(f'{db}_{tb}', {})
|
||||
|
||||
|
5
main.py
5
main.py
@ -1,3 +1,6 @@
|
||||
import clickhouse_driver
|
||||
from clickhouse_driver import Client
|
||||
|
||||
from ck.ck import CK
|
||||
from common import *
|
||||
|
||||
@ -21,6 +24,8 @@ def run():
|
||||
del msg['type']
|
||||
|
||||
ck_client.send(db, table, msg)
|
||||
except clickhouse_driver.errors.NetworkError:
|
||||
ck_client.set_connect(Client(**settings.CK_CONFIG))
|
||||
except Exception as e:
|
||||
print(traceback.print_exc())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user