Added permission error catch for setting up hishel cache
This commit is contained in:
@@ -13,13 +13,22 @@ from scheduler.asyncio.scheduler import Scheduler
|
|||||||
|
|
||||||
from spoolman import filecache
|
from spoolman import filecache
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_EXTERNAL_DB_URL = "https://donkie.github.io/SpoolmanDB/"
|
DEFAULT_EXTERNAL_DB_URL = "https://donkie.github.io/SpoolmanDB/"
|
||||||
DEFAULT_SYNC_INTERVAL = 3600
|
DEFAULT_SYNC_INTERVAL = 3600
|
||||||
|
|
||||||
controller = hishel.Controller(allow_stale=True)
|
controller = hishel.Controller(allow_stale=True)
|
||||||
|
try:
|
||||||
cache_storage = hishel.AsyncFileStorage()
|
cache_storage = hishel.AsyncFileStorage()
|
||||||
|
except PermissionError:
|
||||||
logger = logging.getLogger(__name__)
|
logger.warning(
|
||||||
|
"Failed to setup disk-based cache due to permission error. Ensure the path %s is writable. "
|
||||||
|
"Using in-memory cache instead as fallback.",
|
||||||
|
str(Path(".cache/hishel").resolve()),
|
||||||
|
)
|
||||||
|
cache_storage = hishel.AsyncInMemoryStorage()
|
||||||
|
|
||||||
|
|
||||||
class SpoolType(Enum):
|
class SpoolType(Enum):
|
||||||
|
|||||||
Reference in New Issue
Block a user