Update doc['atime'] in background after Resolve()/ResolveURI() is called

Bug #1089831 reported by Jason Gerard DeRose
6
This bug affects 1 person
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://bazaar.launchpad.net/~dmedia/dmedia/trunk/view/head:/dmedia/views.py#L106

(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

Changed in dmedia:
status: In Progress → Fix Committed
Changed in dmedia:
status: Fix Committed → Won't Fix
status: Won't Fix → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.