def worker(channel, queue, token, repo_ids=None, build_ids=None):
allowed_repo_ids = frozenset(token['repo_ids'])
while (await channel.wait_message()):
msg = await channel.get_json()
data = msg.get('data')
if data['repository']['id'] not in allowed_repo_ids:
continue
if build_ids and data['id'] not in build_ids:
continue
if repo_ids and data['repository']['id'] not in repo_ids:
continue
evt = Event(
msg.get('id'),
msg.get('event'),
data,
)
await queue.put(evt)
current_app.logger.debug(
'pubsub.event.received qsize=%s', queue.qsize())
# @log_errors
评论列表
文章目录