Skip to content

Commit

Permalink
commit db changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Jan 7, 2025
1 parent f484fac commit 1517019
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions hivemind_core/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,11 @@ def handle_new_client(self, client: HiveMindClientConnection):

def update_last_seen(self, client: HiveMindClientConnection):
"""track timestamps of last client interaction"""
user = self.db.get_client_by_api_key(client.key)
user.last_seen = time.time()
self.db.update_item(user)
with self.db:
user = self.db.get_client_by_api_key(client.key)
user.last_seen = time.time()
LOG.debug(f"updated last seen timestamp: {client.key} - {user.last_seen}")
self.db.update_item(user)

def handle_client_disconnected(self, client: HiveMindClientConnection):
try:
Expand Down

0 comments on commit 1517019

Please sign in to comment.