Update doc['atime'] in background after Resolve()/ResolveURI() is called
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Dmedia |
Fix Released
|
High
|
Jason Gerard DeRose |
Bug Description
The latest file access time for files in Dmedia is stored in doc['atime'] and is used to prioritize file reclamation (so we first reclaim the least-likely to be used). See the file/reclaimable view for details:
http://
(Eventually will use doc['atime'] to influence search behavior also.)
For performance reasons, thus far we haven't actually been updating doc['atime'] when the Dmedia.Resolve() or Dmedia.ResolveURI() DBus methods are called. The simple approach of just saving the atime during the method call is too slow, plus we want to limit the document updates when the same file is accessed many times during a short interval.
So I'm proposing my LazyAccess class that saves the atimes in a GLib.timeout_add() at most once every 30 seconds, and updates any accessed docs all at once. Or if 200 or more unique files have been accessed before that 30 seconds, those are flushed synchronously during the method call. I'll have a better solution for this eventually, and accessing at that kind of rate is not typically anyway.
This is something that will certainly need more tuning, but I think we really need this behavior turned on now.
Related branches
- James Raymond: Approve
-
Diff: 274 lines (+198/-8)3 files modifieddmedia-service (+15/-3)
dmedia/service/background.py (+63/-2)
dmedia/service/tests/test_background.py (+120/-3)
Changed in dmedia: | |
status: | In Progress → Fix Committed |
Changed in dmedia: | |
status: | Fix Committed → Won't Fix |
status: | Won't Fix → Fix Released |