feat(jobs): incremental scans, deep mode & folder selection #188
No Reviewers
Labels
Clear labels
AI Gen
area:auth
area:backend
area:ci
area:db
area:frontend
area:shared
good first issue
Need Triage
page:admin-users
page:album-detail
page:albums
page:cosplayer-detail
page:cosplayers
page:home
page:jobs
page:login
page:photos
page:register
page:settings
page:stats
page:user
performance
priority:critical
priority:high
priority:low
priority:medium
type:docs
type:refactor
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
Autogenerated By AI
Authentication, JWT, refresh tokens
Lactose API (controllers, repos, services, models)
Docker, CI/CD, Gitea Actions
EF Core, migrations, pgvector
MilkStream WASM client (Blazor UI, SCSS, components)
Butter shared library (DTOs, enums, MIME types)
Good for new contributors
Needs to be categorized by a Human
Admin user management (/Users)
Album detail page (/albums/{id})
Albums list (/albums)
Cosplayer detail page (/cosplayer/{id})
Cosplayers list (/cosplayers)
Home page (/)
Background jobs page (/Jobs)
Login page (/login)
Photos page (/photos)
Register page (/Register)
Settings page (/Settings)
Statistics page (/Stats)
User profile page (/User/{id})
Performance or scalability concern
Blocker / must fix immediately
Must fix / urgent
Nice to have
Should fix
Documentation
Code cleanup or refactoring
Something is not working
This issue or pull request already exists
New feature
Need some help
Something is wrong
More information is needed
This won't be fixed
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: MilkyShots/MilkyShots#188
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Implements the scan-infrastructure work tracked in #183, #184, #185, #186 and #187 (all in milestone v1.1).
Summary
Reworks the file-system crawl and person/album discovery jobs so unchanged data is never re-scanned, exposes a "deep" scan mode and folder selection, and merges Create Persons into a single discovery job.
Backend
DirectoryScanStatetable stores each directory's last-known mtime. The crawl always descends (directory mtime only reflects direct changes), but only enumerates files and reconciles the DB for directories whose mtime changed.Save()per file). Uses a dedicated asset context so the change tracker can be cleared per directory without detaching scan-state rows.IX_Assets_FolderId_Idon(FolderId, Id)filtered onDeletedAt IS NULLpowers keyset pagination.CreateAlbumsJobis now the single "Create Persons & Albums" job and also covers person-only folders.CreatePersonsJobis deleted (scheduler method, controller case, Jobs page button removed;EJobType.CreatePersonskept so pastJobRecordsstill deserialize).Folder.LastDiscoveryScanAt; repeat runs scan only new assets. Auto-deep rescan when the folder's regex pattern changes (LastDiscoveryScannedRegex).AssetAlbumStagingtable and bulkINSERT INTO "AlbumAsset" ... ON CONFLICT DO NOTHING(removes the second full scan and per-batch EXISTS queries).JobRequestDto.Parametersconventions: literaldeepand repeatablefolder=<guid>. Applied toFileSystemScanandCreateAlbums; controller validates and scheduler/controller wired accordingly.Frontend
JobsService.StartJobaccepts parameters.Migration
AddIncrementalScanStateadds theFoldercursor columns,DirectoryScanState+AssetAlbumStagingtables, and theIX_Assets_FolderId_Idpartial index (replacing the redundantIX_Assets_FolderIdFK index).Testing
dotnet build MilkyShots.sln).