Allow capping the number of workers
Prevention for hitting GitHub's abuse detection Change-Id: Ic836e3aad4fd2152a05d862ed56e069b7fb4b55d
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import argparse
|
||||||
import concurrent.futures
|
import concurrent.futures
|
||||||
import github
|
import github
|
||||||
import json
|
import json
|
||||||
@@ -6,6 +7,10 @@ import traceback
|
|||||||
from github import Github
|
from github import Github
|
||||||
from base64 import b64decode
|
from base64 import b64decode
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument('-j', '--jobs', type=int, help='Max number of workers to use. Default is none')
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
with open('token') as f:
|
with open('token') as f:
|
||||||
g = Github(f.readline().strip(), per_page=200)
|
g = Github(f.readline().strip(), per_page=200)
|
||||||
|
|
||||||
@@ -65,8 +70,7 @@ n = 1
|
|||||||
dependencies = {}
|
dependencies = {}
|
||||||
other_repos = set()
|
other_repos = set()
|
||||||
|
|
||||||
|
with concurrent.futures.ThreadPoolExecutor(max_workers=args.jobs) as executor:
|
||||||
with concurrent.futures.ThreadPoolExecutor() as executor:
|
|
||||||
for repo in g.get_organization('LineageOS').get_repos():
|
for repo in g.get_organization('LineageOS').get_repos():
|
||||||
if '_device_' not in repo.name:
|
if '_device_' not in repo.name:
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user