Skip to content

Commit

Permalink
fix sqlite closed connection
Browse files Browse the repository at this point in the history
  • Loading branch information
m4dm4rtig4n committed Nov 18, 2021
1 parent a0707c0 commit ed5b10a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 42 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.7.3
0.7.4
46 changes: 5 additions & 41 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])

0 comments on commit ed5b10a

Please sign in to comment.