use queue when upgrading, flushing every so often

Added a cheap way to query the size of a queue.

runQueueAt is not the default yet only because there may be some code that
expects to be able to queue some suff, do something else, and run the whole
queue at the end.

10240 is an arbitrary size for the queue. If we assume annexed
filenames are between 10 and 255 characters long, then the queue will
build up between 100kb and 2550kb long commands. The max command line
length on linux is somewhere above 20k, so this is a fairly good balance --
the queue will buffer only a few megabytes of stuff and a minimal number
of commands will be run by xargs.

Also, insert queue items strictly, this should save memory.
This commit is contained in:
Joey Hess 2011-03-16 15:10:15 -04:00
parent 0f8edc99ee
commit bc21502b9a
4 changed files with 34 additions and 18 deletions

View file

@ -99,7 +99,7 @@ startup = do
shutdown :: Annex Bool
shutdown = do
q <- Annex.getState Annex.repoqueue
unless (q == GitQueue.empty) $ do
unless (0 == GitQueue.size q) $ do
showSideAction "Recording state in git..."
Annex.queueRun