[MediaWiki-commits] [Gerrit] pywikibot/core[master]: Print additional warning when starting a thread fails

2016-09-11 Thread jenkins-bot (Code Review)
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 
Gerrit-Reviewer: John Vandenberg 
Gerrit-Reviewer: Merlijn van Deen 
Gerrit-Reviewer: Mpaa 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] pywikibot/core[master]: Print additional warning when starting a thread fails

2016-09-10 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/309730

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(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/30/309730/1

diff --git a/scripts/weblinkchecker.py b/scripts/weblinkchecker.py
index 9f5abb5..ee32177 100755
--- a/scripts/weblinkchecker.py
+++ b/scripts/weblinkchecker.py
@@ -862,14 +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():
 """Generator for pages in History."""

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1cebcfa6e49f0e68975d7e9062e1dd3825b9a7ac
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

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