Log locking of DB
This commit is contained in:
parent
2d19cd4d63
commit
f5d98d66d4
1 changed files with 5 additions and 1 deletions
|
@ -3,11 +3,12 @@
|
||||||
from __future__ import absolute_import, division, unicode_literals
|
from __future__ import absolute_import, division, unicode_literals
|
||||||
from threading import Lock
|
from threading import Lock
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
from logging import getLogger
|
||||||
|
|
||||||
from .. import utils, path_ops, app
|
from .. import utils, path_ops, app
|
||||||
|
|
||||||
KODIDB_LOCK = Lock()
|
KODIDB_LOCK = Lock()
|
||||||
|
LOG = getLogger('PLEX.playback')
|
||||||
|
|
||||||
def catch_operationalerrors(method):
|
def catch_operationalerrors(method):
|
||||||
@wraps(method)
|
@wraps(method)
|
||||||
|
@ -40,7 +41,9 @@ class KodiDBBase(object):
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
if self.lock:
|
if self.lock:
|
||||||
|
LOG.info('acquiring lock')
|
||||||
KODIDB_LOCK.acquire()
|
KODIDB_LOCK.acquire()
|
||||||
|
LOG.info('acquiring lock succeeded')
|
||||||
self.kodiconn = utils.kodi_sql(self.db_kind)
|
self.kodiconn = utils.kodi_sql(self.db_kind)
|
||||||
self.cursor = self.kodiconn.cursor()
|
self.cursor = self.kodiconn.cursor()
|
||||||
if self._texture_db:
|
if self._texture_db:
|
||||||
|
@ -61,6 +64,7 @@ class KodiDBBase(object):
|
||||||
if self.artconn:
|
if self.artconn:
|
||||||
self.artconn.close()
|
self.artconn.close()
|
||||||
if self.lock:
|
if self.lock:
|
||||||
|
LOG.info('releasing lock')
|
||||||
KODIDB_LOCK.release()
|
KODIDB_LOCK.release()
|
||||||
|
|
||||||
def art_urls(self, kodi_id, kodi_type):
|
def art_urls(self, kodi_id, kodi_type):
|
||||||
|
|
Loading…
Reference in a new issue