diff options
author | Tim Laszlo <tim.laszlo@gmail.com> | 2012-07-24 10:05:31 -0500 |
---|---|---|
committer | Tim Laszlo <tim.laszlo@gmail.com> | 2012-07-24 10:05:31 -0500 |
commit | d86baf9f65817949a8dfdf78ff5ce37c7db2d802 (patch) | |
tree | f385b6f9dc5e6a885064d11618444ea70c3acf62 | |
parent | 6db8afe39da4e63b65b1aeae2d87beda5f5bee26 (diff) | |
download | bcfg2-d86baf9f65817949a8dfdf78ff5ce37c7db2d802.tar.gz bcfg2-d86baf9f65817949a8dfdf78ff5ce37c7db2d802.tar.bz2 bcfg2-d86baf9f65817949a8dfdf78ff5ce37c7db2d802.zip |
DBStats: Limit rows purged when using sqlite
SQLite limits the number of variables allowed in a single SQL statement.
This reduces the number of rows purged when SQLite is used.
-rw-r--r-- | src/lib/Bcfg2/Server/Admin/Reports.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/Bcfg2/Server/Admin/Reports.py b/src/lib/Bcfg2/Server/Admin/Reports.py index 17e1e1e4d..8201ad104 100644 --- a/src/lib/Bcfg2/Server/Admin/Reports.py +++ b/src/lib/Bcfg2/Server/Admin/Reports.py @@ -281,6 +281,10 @@ class Reports(Bcfg2.Server.Admin.Mode): self.log.debug("Filtering by maxdate: %s" % maxdate) ipurge = ipurge.filter(timestamp__lt=maxdate) + if Bcfg2.Server.Reports.settings.DATABASES['default']['ENGINE'] == 'django.db.backends.sqlite3': + grp_limit = 100 + else: + grp_limit = 1000 if state: filtered = True if state not in ('dirty', 'clean', 'modified'): @@ -293,7 +297,7 @@ class Reports(Bcfg2.Server.Admin.Mode): rnum = 0 try: while rnum < count: - grp = list(ipurge[:1000].values("id")) + grp = list(ipurge[:grp_limit].values("id")) # just in case... if not grp: break |