Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Wrede committed Jul 11, 2024
1 parent 5af54fc commit e4bcada
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fedn/network/storage/statestore/mongostatestore.py
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,11 @@ def set_client(self, client_data):
:return:
"""
client_data["updated_at"] = str(datetime.now())
self.clients.update_one({"client_id": client_data["client_id"]}, {"$set": client_data}, True)
try:
self.clients.update_one({"client_id": client_data["client_id"]}, {"$set": client_data}, True)
except KeyError:
# If client_id is not present, use name as identifier, for backwards compatibility
self.clients.update_one({"name": client_data["name"]}, {"$set": client_data}, True)

def get_client(self, client_id):
"""Get client by client_id.
Expand Down

0 comments on commit e4bcada

Please sign in to comment.