jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
IMPR: save the talk page in asynchronous mode if ``-async`` option was given

This makes the script about 3 % faster.

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

diff --git a/scripts/archivebot.py b/scripts/archivebot.py
index ac8b0fc..a067ed5 100755
--- a/scripts/archivebot.py
+++ b/scripts/archivebot.py
@@ -486,8 +486,15 @@
return len(self.header.encode('utf-8')) + sum(t.size()
for t in self.threads)

- def update(self, summary, sort_threads: bool = False) -> None:
- """Recombine threads and save page."""
+ def update(self,
+ summary, *,
+ sort_threads: bool = False,
+ asynchronous: bool = False) -> None:
+ """Recombine threads and save page.
+
+ .. versionchanged:: 10.0
+ the *asynchronous* parameter was added.
+ """
if sort_threads:
pywikibot.info('Sorting threads...')
self.threads.sort(key=lambda t: t.timestamp)
@@ -498,7 +505,7 @@
summary += ' ' + i18n.twtranslate(self.site.code,
'archivebot-archive-full')
self.text = newtext
- self.save(summary)
+ self.save(summary, asynchronous=asynchronous)


class PageArchiver:
@@ -791,7 +798,12 @@
return set()

def run(self) -> None:
- """Process a single DiscussionPage object."""
+ """Process a single DiscussionPage object.
+
+ .. versionchanged:: 10.0
+ save the talk page in asynchronous mode if ``-async`` option
+ was given but archive pages are saved in synchronous mode.
+ """
if not self.page.botMayEdit():
return

@@ -849,7 +861,7 @@
comment = i18n.twtranslate(self.site.code,
'archivebot-page-summary',
self.comment_params)
- self.page.update(comment)
+ self.page.update(comment, asynchronous=self.asynchronous)


def process_page(page, *args: Any) -> bool:

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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Iba54b707c7cec6886d52ff699aacae875e8573e2
Gerrit-Change-Number: 1107088
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot