From a30841cdf6b78802de48f8d370df7eaeab89744e Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Sun, 5 Jan 2020 18:41:46 +0100 Subject: [PATCH] add some debugging here --- owrx/map.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/owrx/map.py b/owrx/map.py index 081a6916..f7a0d5d5 100644 --- a/owrx/map.py +++ b/owrx/map.py @@ -2,6 +2,7 @@ from datetime import datetime, timedelta import threading, time from owrx.config import PropertyManager from owrx.bands import Band +import sys import logging @@ -15,11 +16,13 @@ class Location(object): class Map(object): sharedInstance = None + creationLock = threading.Lock() @staticmethod def getSharedInstance(): - if Map.sharedInstance is None: - Map.sharedInstance = Map() + with Map.creationLock: + if Map.sharedInstance is None: + Map.sharedInstance = Map() return Map.sharedInstance def __init__(self): @@ -111,9 +114,11 @@ class Map(object): self.removeLocation(callsign) def rebuildPositions(self): + logger.debug("rebuilding map storage; size before: %i", sys.getsizeof(self.positions)) with self.positionsLock: p = {key: value for key, value in self.positions.items()} self.positions = p + logger.debug("rebuild complete; size after: %i", sys.getsizeof(self.positions)) class LatLngLocation(Location):