max_concurrent setting

This commit is contained in:
lilydjwg 2017-07-08 15:05:17 +08:00
parent 7c534aec18
commit dfefcd4db9
2 changed files with 8 additions and 2 deletions

View file

@ -120,6 +120,9 @@ newver
proxy
The HTTP proxy to use. The format is ``host:port``, e.g. ``localhost:8087``.
max_concurrent
Max number of concurrent jobs. Default: 20.
Search in a Webpage
-------------------
Search through a specific webpage for the version string. This type of version finding has these fields:

View file

@ -78,9 +78,12 @@ class Source:
os.path.join(d, c.get('oldver'))))
self.newver = os.path.expandvars(os.path.expanduser(
os.path.join(d, c.get('newver'))))
self.max_concurrent = c.getint('max_concurrent', 20)
session.nv_config = config["__config__"]
else:
self.max_concurrent = 20
async def check(self):
if self.oldver:
self.oldvers = read_verfile(self.oldver)
@ -99,7 +102,7 @@ class Source:
fu.name = name
futures.add(fu)
if len(futures) >= 20: # TODO: use __config__
if len(futures) >= self.max_concurrent:
(done, futures) = await asyncio.wait(
futures, return_when = asyncio.FIRST_COMPLETED)
for fu in done: