[BACKEND] File lock directory config parameter
This commit is contained in:
parent
3d3fe32b3a
commit
3ec850760d
2 changed files with 6 additions and 6 deletions
|
|
@ -134,7 +134,7 @@ def _working_directory_lock(config: ConfigFile):
|
||||||
working_directory_path = Path(os.getcwd()) / config.config_options.working_directory
|
working_directory_path = Path(os.getcwd()) / config.config_options.working_directory
|
||||||
lock_file_path = (
|
lock_file_path = (
|
||||||
Path(os.getcwd())
|
Path(os.getcwd())
|
||||||
/ config.config_options.flock_directory
|
/ config.config_options.lock_directory
|
||||||
/ str(working_directory_path).replace("/", "_")
|
/ str(working_directory_path).replace("/", "_")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ from ytdl_sub.validators.validators import StringValidator
|
||||||
|
|
||||||
class ConfigOptions(StrictDictValidator):
|
class ConfigOptions(StrictDictValidator):
|
||||||
_required_keys = {"working_directory"}
|
_required_keys = {"working_directory"}
|
||||||
_optional_keys = {"umask", "dl_aliases", "flock_directory"}
|
_optional_keys = {"umask", "dl_aliases", "lock_directory"}
|
||||||
|
|
||||||
def __init__(self, name: str, value: Any):
|
def __init__(self, name: str, value: Any):
|
||||||
super().__init__(name, value)
|
super().__init__(name, value)
|
||||||
|
|
@ -26,8 +26,8 @@ class ConfigOptions(StrictDictValidator):
|
||||||
self._dl_aliases = self._validate_key_if_present(
|
self._dl_aliases = self._validate_key_if_present(
|
||||||
key="dl_aliases", validator=LiteralDictValidator
|
key="dl_aliases", validator=LiteralDictValidator
|
||||||
)
|
)
|
||||||
self._flock_directory = self._validate_key(
|
self._lock_directory = self._validate_key(
|
||||||
key="flock_directory", validator=StringValidator, default="/tmp"
|
key="lock_directory", validator=StringValidator, default="/tmp"
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
@ -74,13 +74,13 @@ class ConfigOptions(StrictDictValidator):
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def flock_directory(self) -> str:
|
def lock_directory(self) -> str:
|
||||||
"""
|
"""
|
||||||
Optional. The directory to temporarily store file locks, which prevents multiple instances
|
Optional. The directory to temporarily store file locks, which prevents multiple instances
|
||||||
of ``ytdl-sub`` from running. Note that file locks do not work on network-mounted
|
of ``ytdl-sub`` from running. Note that file locks do not work on network-mounted
|
||||||
directories. Ensure that this directory resides on the host machine. Defaults to ``/tmp``.
|
directories. Ensure that this directory resides on the host machine. Defaults to ``/tmp``.
|
||||||
"""
|
"""
|
||||||
return self._flock_directory.value
|
return self._lock_directory.value
|
||||||
|
|
||||||
|
|
||||||
class ConfigValidator(StrictDictValidator):
|
class ConfigValidator(StrictDictValidator):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue