From 170f810735131998b4671cda6fc39a80e7c77ea5 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Mon, 27 Oct 2014 14:23:08 -0500 Subject: [PATCH] Allow ExclusionDB to force a sync. --- earwigbot/wiki/copyvios/exclusions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/earwigbot/wiki/copyvios/exclusions.py b/earwigbot/wiki/copyvios/exclusions.py index 4205f86..4a17cd9 100644 --- a/earwigbot/wiki/copyvios/exclusions.py +++ b/earwigbot/wiki/copyvios/exclusions.py @@ -140,14 +140,14 @@ class ExclusionsDB(object): return 0 return result[0] if result else 0 - def sync(self, sitename): + def sync(self, sitename, force=False): """Update the database if it hasn't been updated in the past day. - This only updates the exclusions database for the *sitename* site. + This updates the exclusions database for the site *sitename* and "all". """ max_staleness = 60 * 60 * 24 time_since_update = int(time() - self._get_last_update(sitename)) - if time_since_update > max_staleness: + if force or time_since_update > max_staleness: log = u"Updating stale database: {0} (last updated {1} seconds ago)" self._logger.info(log.format(sitename, time_since_update)) self._update(sitename)