Skip to content

Commit 8a29d90

Browse files
jenkins-botGerrit Code Review
authored andcommitted
Merge "IMPR: save the talk page in asynchronous mode if -async option was given"
2 parents 201ebc7 + 152a9be commit 8a29d90

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

scripts/archivebot.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,15 @@ def size(self) -> int:
486486
return len(self.header.encode('utf-8')) + sum(t.size()
487487
for t in self.threads)
488488

489-
def update(self, summary, sort_threads: bool = False) -> None:
490-
"""Recombine threads and save page."""
489+
def update(self,
490+
summary, *,
491+
sort_threads: bool = False,
492+
asynchronous: bool = False) -> None:
493+
"""Recombine threads and save page.
494+
495+
.. versionchanged:: 10.0
496+
the *asynchronous* parameter was added.
497+
"""
491498
if sort_threads:
492499
pywikibot.info('Sorting threads...')
493500
self.threads.sort(key=lambda t: t.timestamp)
@@ -498,7 +505,7 @@ def update(self, summary, sort_threads: bool = False) -> None:
498505
summary += ' ' + i18n.twtranslate(self.site.code,
499506
'archivebot-archive-full')
500507
self.text = newtext
501-
self.save(summary)
508+
self.save(summary, asynchronous=asynchronous)
502509

503510

504511
class PageArchiver:
@@ -791,7 +798,12 @@ def analyze_page(self) -> set[tuple[str, str]]:
791798
return set()
792799

793800
def run(self) -> None:
794-
"""Process a single DiscussionPage object."""
801+
"""Process a single DiscussionPage object.
802+
803+
.. versionchanged:: 10.0
804+
save the talk page in asynchronous mode if ``-async`` option
805+
was given but archive pages are saved in synchronous mode.
806+
"""
795807
if not self.page.botMayEdit():
796808
return
797809

@@ -849,7 +861,7 @@ def run(self) -> None:
849861
comment = i18n.twtranslate(self.site.code,
850862
'archivebot-page-summary',
851863
self.comment_params)
852-
self.page.update(comment)
864+
self.page.update(comment, asynchronous=self.asynchronous)
853865

854866

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

0 commit comments

Comments
 (0)