jenkins-bot has submitted this change and it was merged.

Change subject: Print additional warning when starting a thread fails
......................................................................


Print additional warning when starting a thread fails

- print a warning to decrease max_external_links
- increase sleeping time before starting a new thread to config.retry_wait value
  to wait a longer time until a previous thread was finished.

Bug: T145273
Change-Id: I1cebcfa6e49f0e68975d7e9062e1dd3825b9a7ac
---
M scripts/weblinkchecker.py
1 file changed, 10 insertions(+), 3 deletions(-)

Approvals:
  Mpaa: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/scripts/weblinkchecker.py b/scripts/weblinkchecker.py
index 9f5abb5..44e3296 100755
--- a/scripts/weblinkchecker.py
+++ b/scripts/weblinkchecker.py
@@ -862,13 +862,20 @@
                 # Limit the number of threads started at the same time. Each
                 # thread will check one page, then die.
                 while threading.activeCount() >= config.max_external_links:
-                    # wait 100 ms
-                    time.sleep(0.1)
+                    time.sleep(config.retry_wait)
                 thread = LinkCheckThread(page, url, self.history,
                                          self.HTTPignore, self.day)
                 # thread dies when program terminates
                 thread.setDaemon(True)
-                thread.start()
+                try:
+                    thread.start()
+                except threading.ThreadError:
+                    pywikibot.warning(
+                        "Can't start a new thread.\nPlease decrease "
+                        "max_external_links in your user-config.py or use\n"
+                        "'-max_external_links:' option with a smaller value. "
+                        "Default is 50.")
+                    raise
 
 
 def RepeatPageGenerator():

-- 
To view, visit https://gerrit.wikimedia.org/r/309730
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1cebcfa6e49f0e68975d7e9062e1dd3825b9a7ac
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <i...@gno.de>
Gerrit-Reviewer: John Vandenberg <jay...@gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhall...@arctus.nl>
Gerrit-Reviewer: Mpaa <mpaa.w...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to