use a transaction for getFiles

This commit is contained in:
Vincent Riquer 2013-02-26 02:11:40 +01:00
parent 00635b3ce9
commit f50fcdb8f0

5
atom
View File

@ -418,6 +418,8 @@ InsertOrUpdate() {
getFiles() { getFiles() {
scantime=$(date +%s) scantime=$(date +%s)
# We probably have thousands of files, don't waste time on disk writes
echo 'BEGIN TRANSACTION;' >&3
while read time size filename while read time size filename
do do
sourcefileid=$( sourcefileid=$(
@ -429,10 +431,11 @@ getFiles() {
filename $filename filename $filename
EOWhere EOWhere
) )
echo $sourcefileid "$filename" echo -ne '\r'$sourcefileid
done < <( done < <(
find "$sourcepath" -type f -printf "%T@ %s %P\n" find "$sourcepath" -type f -printf "%T@ %s %P\n"
) )
echo 'COMMIT;' >&3
} }
getType() { getType() {