X-Git-Url: http://git.onelab.eu/?p=sfa.git;a=blobdiff_plain;f=sfa%2Futil%2Fcallids.py;h=ead60bbe90d2f9eebd69291ae26b1bc0b107c25a;hp=904c42b48b5b9fae8aba51e4608415adbdd59e43;hb=db091e73c33c373b7f6c2c96bd2caf6a2acf0178;hpb=d2ef805930518b254a2e0f55b3ff66d83497dca8 diff --git a/sfa/util/callids.py b/sfa/util/callids.py index 904c42b4..ead60bbe 100644 --- a/sfa/util/callids.py +++ b/sfa/util/callids.py @@ -3,7 +3,7 @@ import threading import time -from sfa.util.sfalogging import sfa_logger +from sfa.util.sfalogging import logger """ Callids: a simple mechanism to remember the call ids served so fas @@ -33,15 +33,15 @@ class _call_ids_impl (dict): if not call_id: return False has_lock=False for attempt in range(_call_ids_impl.retries): - if debug: sfa_logger().debug("Waiting for lock (%d)"%attempt) + if debug: logger.debug("Waiting for lock (%d)"%attempt) if self._lock.acquire(False): has_lock=True - if debug: sfa_logger().debug("got lock (%d)"%attempt) + if debug: logger.debug("got lock (%d)"%attempt) break time.sleep(float(_call_ids_impl.wait_ms)/1000) # in the unlikely event where we can't get the lock if not has_lock: - sfa_logger().warning("_call_ids_impl.should_handle_call_id: could not acquire lock") + logger.warning("_call_ids_impl.should_handle_call_id: could not acquire lock") return False # we're good to go if self.has_key(call_id): @@ -51,7 +51,7 @@ class _call_ids_impl (dict): self[call_id]=time.time() self._purge() self._lock.release() - if debug: sfa_logger().debug("released lock") + if debug: logger.debug("released lock") return False def _purge(self): @@ -60,11 +60,11 @@ class _call_ids_impl (dict): for (k,v) in self.iteritems(): if (now-v) >= _call_ids_impl.purge_timeout: o_keys.append(k) for k in o_keys: - if debug: sfa_logger().debug("Purging call_id %r (%s)"%(k,time.strftime("%H:%M:%S",time.localtime(self[k])))) + if debug: logger.debug("Purging call_id %r (%s)"%(k,time.strftime("%H:%M:%S",time.localtime(self[k])))) del self[k] if debug: - sfa_logger().debug("AFTER PURGE") - for (k,v) in self.iteritems(): sfa_logger().debug("%s -> %s"%(k,time.strftime("%H:%M:%S",time.localtime(v)))) + logger.debug("AFTER PURGE") + for (k,v) in self.iteritems(): logger.debug("%s -> %s"%(k,time.strftime("%H:%M:%S",time.localtime(v)))) def Callids (): if not _call_ids_impl._instance: