add some debugging here

This commit is contained in:
Jakob Ketterl 2020-01-05 18:41:46 +01:00
parent aad904f1a1
commit a30841cdf6

View File

@ -2,6 +2,7 @@ from datetime import datetime, timedelta
import threading, time import threading, time
from owrx.config import PropertyManager from owrx.config import PropertyManager
from owrx.bands import Band from owrx.bands import Band
import sys
import logging import logging
@ -15,9 +16,11 @@ class Location(object):
class Map(object): class Map(object):
sharedInstance = None sharedInstance = None
creationLock = threading.Lock()
@staticmethod @staticmethod
def getSharedInstance(): def getSharedInstance():
with Map.creationLock:
if Map.sharedInstance is None: if Map.sharedInstance is None:
Map.sharedInstance = Map() Map.sharedInstance = Map()
return Map.sharedInstance return Map.sharedInstance
@ -111,9 +114,11 @@ class Map(object):
self.removeLocation(callsign) self.removeLocation(callsign)
def rebuildPositions(self): def rebuildPositions(self):
logger.debug("rebuilding map storage; size before: %i", sys.getsizeof(self.positions))
with self.positionsLock: with self.positionsLock:
p = {key: value for key, value in self.positions.items()} p = {key: value for key, value in self.positions.items()}
self.positions = p self.positions = p
logger.debug("rebuild complete; size after: %i", sys.getsizeof(self.positions))
class LatLngLocation(Location): class LatLngLocation(Location):