mirror of
https://github.com/ajurna/cbwebreader.git
synced 2026-11-02 10:36:55 +00:00
**Refactor directory scanning and add scan task support**
- Added a new `scan_directory` task to enable folder scans as asynchronous tasks while maintaining compatibility with the immediate backend. - Introduced the `reconcile` function, replacing `generate_directory` for improved separation of concerns between database writes and read operations. - Established a unique constraint on `Directory` (`one_directory_name_per_parent`) to prevent duplicate directories under the same parent. - Added a "Scan" button to the frontend for re-reading folders from disk, along with new task invocation endpoints in the API. - Updated tests across modules to validate the new `scan_directory` task, unique constraints, and database indexing logic. - Improved cleanup logic for stale files, directories, and thumbnails to handle concurrent operations efficiently. - Simplified `scan_comics` management command by removing user dependency and aligning it with the new `reconcile` function. - Enhanced frontend components (`TheComicReader`, `TheComicList`, and others) to include lifecycle method cleanups, prevent memory leaks, and handle task-based scans.
This commit is contained in:
1 parent
4d0ba750ad
commit
ce809ed1a9
18 files changed
+364
-81
No files matched your search
@@ -37,12 +37,10 @@ INSTALLED_APPS = [
|
||||
"django.contrib.staticfiles",
|
||||
'drf_yasg',
|
||||
'webpack_loader',
|
||||
'bootstrap4',
|
||||
"comic",
|
||||
'django_extensions',
|
||||
'imagekit',
|
||||
'django_boost',
|
||||
'sri',
|
||||
"corsheaders",
|
||||
'django_filters',
|
||||
'rest_framework',
|
||||
@@ -264,6 +262,15 @@ SIMPLE_JWT = {
|
||||
# cbreader/urls.py matches the dot separately. See cbreader/urls.py.
|
||||
SWAGGER_USE_COMPAT_RENDERERS = False
|
||||
|
||||
# Folder scans run through comic.tasks.scan_directory. The immediate backend runs the task
|
||||
# in the caller, which is enough today; swapping to a queue backend later changes only
|
||||
# this block, not the call sites.
|
||||
TASKS = {
|
||||
'default': {
|
||||
'BACKEND': os.getenv('TASK_BACKEND', 'django.tasks.backends.immediate.ImmediateBackend'),
|
||||
},
|
||||
}
|
||||
|
||||
FRONTEND_DIR = os.path.join(BASE_DIR, 'frontend')
|
||||
|
||||
TEMPLATES = [
|
||||
|
||||
Reference in new issue
Block a user