remove affected check, to delete jails always (pass testPurge)

pull/716/head
sebres 2014-05-14 12:32:30 +02:00
parent 99c9cbf470
commit f492aa7ac9
1 changed files with 3 additions and 7 deletions

View File

@ -602,18 +602,14 @@ class Fail2BanDb(object):
"DELETE FROM bips WHERE timeofban < ? and bantime != -1 and (timeofban + (bantime * ?)) < ?",
(int(MyTime.time()) - self._purgeAge, self._outDatedFactor, int(MyTime.time()) - self._purgeAge))
#@commitandrollback
def purge(self):
@commitandrollback
def purge(self, cur):
"""Purge old bans, jails and log files from database.
"""
cur = self._db.cursor()
self._bansMergedCache = {}
cur.execute(
"DELETE FROM bans WHERE timeofban < ?",
(MyTime.time() - self._purgeAge, ))
affected = cur.rowcount
self._purge_bips(cur)
affected += cur.rowcount
if affected:
self._cleanjails(cur)
self._cleanjails(cur)