Popularity computation background job #114
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add a scheduled background job that aggregates view log data into popularity scores for each timeframe (Daily, Weekly, Monthly, AllTime).
Job:
ComputePopularityJobExtends the existing
Jobabstract class (likeFileSystemCrawlJob,ThumbnailJob, etc.).Algorithm
For each entity type (Asset, Album, Person) and each timeframe:
For each (entity, timeframe) pair:
(ViewerIp, ViewerUserId)tuples per entity within the windowCaching
Write results to an in-memory cache (
IMemoryCacheorConcurrentDictionary) for fast API reads. Optionally back it with aPopularityCacheDB table for persistence across restarts.Scheduling
JobSchedulerto run nightly (e.g.,Timer(TimeSpan.FromHours(24)))/api/jobs(admin) via existing job infrastructureEdge cases
Settings integration
Read thresholds from settings (see #117):
PopularMinViews— minimum views to qualifyPopularMaxResults— top-N limit per timeframePart of: #110