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