jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
Determine whether counter matters only once

Change-Id: I2839767db7a0039f9c22306409637e86abae0f3e
---
M scripts/archivebot.py
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/scripts/archivebot.py b/scripts/archivebot.py
index 25f80b3..8b15bd0 100755
--- a/scripts/archivebot.py
+++ b/scripts/archivebot.py
@@ -691,6 +691,11 @@
threads_per_archive[key].append((i, thread))
whys.add(why) # xxx: we don't now if we ever archive anything

+ params = self.get_params(self.now, counter)
+ aux_params = self.get_params(self.now, counter + 1)
+ counter_matters = (pattern % params) != (pattern % aux_params)
+ del params, aux_params
+
# we need to start with the oldest archive since that is
# the one the saved counter applies to, so sort the groups
# by the oldest timestamp
@@ -703,7 +708,6 @@
# 1. it matters (AND)
# 2. "era" (year, month, etc.) changes (AND)
# 3. there is something to put to the new archive.
- counter_matters = False
for i, thread in group:
threads_left = len(self.page.threads) - self.archived_threads
if threads_left <= int(self.get_attr('minthreadsleft', 5)):
@@ -717,11 +721,6 @@
params = self.get_params(thread.timestamp, counter)
archive = self.get_archive_page(pattern % params, params)

- aux_params = self.get_params(thread.timestamp, counter + 1)
- # TODO: this variable does not change, figure out a way
- # to only compute it once
- counter_matters = (pattern % params) != (pattern % aux_params)
- del aux_params
if counter_matters:
while counter > 1 and not archive.exists():
# This may happen when either:

To view, visit change 621313. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I2839767db7a0039f9c22306409637e86abae0f3e
Gerrit-Change-Number: 621313
Gerrit-PatchSet: 1
Gerrit-Owner: Matěj Suchánek <matejsuchanek97@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged