Browse Source

Fudge default API query wait times a bit

- Plus a bugfix in RC.parse()
tags/v0.1^2
Ben Kurtovic 12 years ago
parent
commit
5f41a1aa7a
3 changed files with 5 additions and 5 deletions
  1. +1
    -1
      earwigbot/irc/rc.py
  2. +3
    -3
      earwigbot/wiki/site.py
  3. +1
    -1
      earwigbot/wiki/sitesdb.py

+ 1
- 1
earwigbot/irc/rc.py View File

@@ -52,7 +52,7 @@ class RC(object):
# We're probably missing the http:// part, because it's a log # We're probably missing the http:// part, because it's a log
# entry, which lacks a URL: # entry, which lacks a URL:
page, flags, user, comment = self.re_log.findall(msg)[0] page, flags, user, comment = self.re_log.findall(msg)[0]
url = "http://{0}.org/wiki/{1}".format(self.chan, page)
url = "http://{0}.org/wiki/{1}".format(self.chan[1:], page)


self.is_edit = False # This is a log entry, not edit self.is_edit = False # This is a log entry, not edit




+ 3
- 3
earwigbot/wiki/site.py View File

@@ -86,7 +86,7 @@ class Site(object):
article_path=None, script_path=None, sql=None, article_path=None, script_path=None, sql=None,
namespaces=None, login=(None, None), cookiejar=None, namespaces=None, login=(None, None), cookiejar=None,
user_agent=None, use_https=False, assert_edit=None, user_agent=None, use_https=False, assert_edit=None,
maxlag=None, wait_between_queries=5, logger=None,
maxlag=None, wait_between_queries=3, logger=None,
search_config=(None, None)): search_config=(None, None)):
"""Constructor for new Site instances. """Constructor for new Site instances.


@@ -120,7 +120,7 @@ class Site(object):
self._assert_edit = assert_edit self._assert_edit = assert_edit
self._maxlag = maxlag self._maxlag = maxlag
self._wait_between_queries = wait_between_queries self._wait_between_queries = wait_between_queries
self._max_retries = 5
self._max_retries = 6
self._last_query_time = 0 self._last_query_time = 0
self._api_lock = Lock() self._api_lock = Lock()


@@ -276,7 +276,7 @@ class Site(object):
msg = 'Server says "{0}"; retrying in {1} seconds ({2}/{3})' msg = 'Server says "{0}"; retrying in {1} seconds ({2}/{3})'
self._logger.info(msg.format(info, wait, tries, self._max_retries)) self._logger.info(msg.format(info, wait, tries, self._max_retries))
sleep(wait) sleep(wait)
return self._api_query(params, tries=tries, wait=wait*3)
return self._api_query(params, tries=tries, wait=wait*2)
else: # Some unknown error occurred else: # Some unknown error occurred
e = 'API query failed: got error "{0}"; server says: "{1}".' e = 'API query failed: got error "{0}"; server says: "{1}".'
error = exceptions.SiteAPIError(e.format(code, info)) error = exceptions.SiteAPIError(e.format(code, info))


+ 1
- 1
earwigbot/wiki/sitesdb.py View File

@@ -175,7 +175,7 @@ class SitesDB(object):
use_https = config.wiki.get("useHTTPS", False) use_https = config.wiki.get("useHTTPS", False)
assert_edit = config.wiki.get("assert") assert_edit = config.wiki.get("assert")
maxlag = config.wiki.get("maxlag") maxlag = config.wiki.get("maxlag")
wait_between_queries = config.wiki.get("waitTime", 5)
wait_between_queries = config.wiki.get("waitTime", 3)
logger = self._logger.getChild(name) logger = self._logger.getChild(name)
search_config = config.wiki.get("search") search_config = config.wiki.get("search")




Loading…
Cancel
Save