mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 08:39:17 +01:00
Move timeout config getter to library from dbcore
I wanted to move it up even higher, but I wanted to hold off on that for a bit longer.
This commit is contained in:
parent
c1e04ac039
commit
8d7a626074
2 changed files with 5 additions and 4 deletions
|
|
@ -692,8 +692,9 @@ class Database(object):
|
||||||
"""The Model subclasses representing tables in this database.
|
"""The Model subclasses representing tables in this database.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, path):
|
def __init__(self, path, timeout=5.0):
|
||||||
self.path = path
|
self.path = path
|
||||||
|
self.timeout = timeout
|
||||||
|
|
||||||
self._connections = {}
|
self._connections = {}
|
||||||
self._tx_stacks = defaultdict(list)
|
self._tx_stacks = defaultdict(list)
|
||||||
|
|
@ -732,8 +733,7 @@ class Database(object):
|
||||||
# bytestring paths here on Python 3, so we need to
|
# bytestring paths here on Python 3, so we need to
|
||||||
# provide a `str` using `py3_path`.
|
# provide a `str` using `py3_path`.
|
||||||
conn = sqlite3.connect(
|
conn = sqlite3.connect(
|
||||||
py3_path(self.path),
|
py3_path(self.path), timeout=self.timeout
|
||||||
timeout=beets.config['timeout'].as_number(),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Access SELECT results like dictionaries.
|
# Access SELECT results like dictionaries.
|
||||||
|
|
|
||||||
|
|
@ -1216,7 +1216,8 @@ class Library(dbcore.Database):
|
||||||
path_formats=((PF_KEY_DEFAULT,
|
path_formats=((PF_KEY_DEFAULT,
|
||||||
'$artist/$album/$track $title'),),
|
'$artist/$album/$track $title'),),
|
||||||
replacements=None):
|
replacements=None):
|
||||||
super(Library, self).__init__(path)
|
timeout = beets.config['timeout'].as_number()
|
||||||
|
super(Library, self).__init__(path, timeout=timeout)
|
||||||
|
|
||||||
self._connection().create_function('bytelower', 1, _sqlite_bytelower)
|
self._connection().create_function('bytelower', 1, _sqlite_bytelower)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue