Skip to content
Snippets Groups Projects
Commit 38407d2f authored by Jonah Husson's avatar Jonah Husson
Browse files

Fixes for deployed issues

parent 83025eb5
Branches
No related tags found
1 merge request!9Remove truncate and add on conflict clause instead
......@@ -73,7 +73,7 @@ def main():
current_chain_conf = {}
init_auth = get_authorizer_nodes(auth_conn)
for i in init_auth:
auth_nids.add(i[0])
auth_nids.add(bytes(i[0]))
while True:
try:
log.info("Polling substrate...")
......@@ -110,7 +110,7 @@ def main():
# Pass a copy because the dict will be mutated
set_active_nodes(conn, copy.deepcopy(new_dict))
# Update the new dictionary of active nodes
#
active_dict = new_dict
time.sleep(polling_freq)
......@@ -712,7 +712,7 @@ def set_authorizer_nodes(conn, to_add, to_delete):
delete_command = "DELETE FROM nodes WHERE id = %s;"
for row in node_list:
if row[0] in to_delete:
if bytes(row[0]) in to_delete:
try:
cur.execute(delete_command, (row[0],))
log.debug(cur.query)
......@@ -722,6 +722,7 @@ def set_authorizer_nodes(conn, to_add, to_delete):
if row[1]:
to_revoke.append(row[1])
if len(to_add) > 0:
insert_list = [(i, None, None) for i in to_add]
# Insert Node information into authorizer db
insert_command = "INSERT INTO nodes (id, ip_address, last_updated) VALUES" + \
......@@ -736,6 +737,7 @@ def set_authorizer_nodes(conn, to_add, to_delete):
raise e
finally:
cur.close()
return to_revoke
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment