diff options
author | Dan McGee <dan@archlinux.org> | 2012-07-08 20:56:28 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-07-08 21:08:04 -0500 |
commit | 3c4ceb16331b37fd334dc9682d4cde6430838942 (patch) | |
tree | c1c6368cfefd85d7d28d91707d991b0e908d2276 /mirrors/management/commands | |
parent | a1ec14fc68282d67c00c79b5aa6aab60461f056a (diff) |
mirrorcheck: Don't use bulk_create on sqlite3
It isn't worth it, as we run into the 999 max SQL statement variables
issue when using it on any significant amount of mirrors. Since this is
just a development database setup, and it isn't a command we need to run
especially fast, we can ditch it.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'mirrors/management/commands')
-rw-r--r-- | mirrors/management/commands/mirrorcheck.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/mirrors/management/commands/mirrorcheck.py b/mirrors/management/commands/mirrorcheck.py index 3d431796..7a133cbf 100644 --- a/mirrors/management/commands/mirrorcheck.py +++ b/mirrors/management/commands/mirrorcheck.py @@ -30,7 +30,7 @@ import urllib2 from django.core.management.base import NoArgsCommand from django.db import transaction -from main.utils import utc_now +from main.utils import utc_now, database_vendor from mirrors.models import MirrorUrl, MirrorLog logging.basicConfig( @@ -207,7 +207,11 @@ class MirrorCheckPool(object): logger.debug("joining on all threads") self.tasks.join() logger.debug("processing %d log entries", len(self.logs)) - MirrorLog.objects.bulk_create(self.logs) + if database_vendor(MirrorLog, mode='write') == 'sqlite': + for log in self.logs: + log.save(force_insert=True) + else: + MirrorLog.objects.bulk_create(self.logs) logger.debug("log entries saved") # vim: set ts=4 sw=4 et: |