From ed5b10a1cb940a7f03218ace0b2467756c8b9ec3 Mon Sep 17 00:00:00 2001 From: m4dm4rtig4n Date: Thu, 18 Nov 2021 09:06:23 +0100 Subject: [PATCH] fix sqlite closed connection --- README.md | 4 ++++ app/VERSION | 2 +- app/main.py | 46 +++++----------------------------------------- 3 files changed, 10 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index e5bdddb6..555a0436 100755 --- a/README.md +++ b/README.md @@ -259,6 +259,10 @@ make start ## Change log: +### [0.7.4] - 2021-11-18 + +- Fix SQLite closed connection + ### [0.7.3] - 2021-11-17 - Fix debug diff --git a/app/VERSION b/app/VERSION index b09a54cb..ef090a6c 100755 --- a/app/VERSION +++ b/app/VERSION @@ -1 +1 @@ -0.7.3 \ No newline at end of file +0.7.4 \ No newline at end of file diff --git a/app/main.py b/app/main.py index 6d687b93..19461588 100755 --- a/app/main.py +++ b/app/main.py @@ -615,48 +615,12 @@ def run(pdl, pdl_config): while True: + con = sqlite3.connect('/data/enedisgateway.db', timeout=10) + cur = con.cursor() + for pdl, pdl_config in config['enedis_gateway'].items(): run(pdl, pdl_config) con.close() - time.sleep(config['cycle']) - -# lost_params = [] -# for id, config_data in default.items(): -# isDict = False -# if isinstance(default[id], dict): -# isDict = True -# mandatory = False -# if id.startswith('*'): -# mandatory = True -# id = id[1:] -# if mandatory == True and not id in config: -# lost_params.append(id) -# if isDict == True: -# for id_1, data_1 in config_data.items(): -# isDict = False -# if isinstance(config_data[id_1], dict): -# isDict = True -# mandatory = False -# if id_1.startswith('*'): -# mandatory = True -# id_1 = f"{id}.{id_1[1:]}" -# if mandatory == True and not id_1 in config[id]: -# lost_params.append(id_1) -# if isDict == True: -# for id_2, data_2 in data_1.items(): -# mandatory = False -# if id_2.startswith('*'): -# mandatory = True -# id_2 = f"{id_1}.{id_2[1:]}" -# if mandatory == True and not id_2 in config[id]: -# lost_params.append(id_2) -# # else: -# # if not id_2 in config[id][id_1]: -# # config[id][id_1] = data_2 -# else: -# if not id_1 in config[id]: -# config[id] = data_1 -# else: -# if not id in config: -# config[id] = config_data + + time.sleep(config['cycle']) \ No newline at end of file