- command fetch_relays() should be locked
- fixed exception when row[column] is NoneType
def fetch_relays(args: argparse.Namespace) -> int:
logger.debug("args[]='%s' - CALLED!", type(args))
+ logger.debug("Invoking locking.acquire() ...")
+ locking.acquire()
+
if args.domain is not None and args.domain != "":
database.cursor.execute("SELECT domain, software FROM instances WHERE software IN ('activityrelay', 'aoderelay', 'selective-relay') AND domain = ? LIMIT 1", [args.domain])
else:
database.cursor.execute(f"SELECT {column} FROM instances WHERE domain = ? LIMIT 1", [domain])
# Fetch row
- fetched = float(database.cursor.fetchone()[column])
+ row = database.cursor.fetchone()
+
+ fetched = float(row[column]) if row[column] is not None else 0.0
+
diff = (time.time() - fetched)
logger.debug("fetched[%s]='%s',key='%s',diff=%f", type(fetched), fetched, key, diff)