def main():
parser = argparse.ArgumentParser()
parser.add_argument("config")
args = parser.parse_args()
config = parse_config(args.config)
for name, repo in config.items():
github_auth = (repo["github_username"], repo["github_password"])
snooze_label = repo["snooze_label"]
ignore_members_of = repo["ignore_members_of"]
callback = lambda event, message: github_callback(event, message, github_auth,
snooze_label, ignore_members_of)
listener = RepositoryListener(
callbacks=[callback],
events=LISTEN_EVENTS,
**repo)
t = threading.Thread(target=poll_forever, args=(listener, repo["poll_interval"]))
t.daemon = True
t.start()
while True:
# wait forever for a signal or an unusual termination
if threading.active_count() < len(config) + 1:
logging.error("Child polling thread quit!")
return False
time.sleep(1)
return True
评论列表
文章目录