(
    *, connection: RedisConnection, webhook_queue: RedisWebhookQueue, queue_name: str
)
Worker to process incoming webhook events from redis

    1. process mergeability information and update github check status for pr
    2. enqueue pr into repo queue for merging, if mergeability passed
Worker to process incoming webhook events from redis
Worker to process incoming webhook events from redis
async def webhook_event_consumer(
    *, connection: RedisConnection, webhook_queue: RedisWebhookQueue, queue_name: str
) -> typing.NoReturn:
    """
    Worker to process incoming webhook events from redis

    1. process mergeability information and update github check status for pr
    2. enqueue pr into repo queue for merging, if mergeability passed
    """

    # We need to define a custom Hub so that we can set the scope correctly.
    # Without creating a new hub we end up overwriting the scopes of other
    # consumers.
    #
    # https://github.com/getsentry/sentry-python/issues/147#issuecomment-432959196
    # https://github.com/getsentry/sentry-python/blob/0da369f839ee2c383659c91ea8858abcac04b869/sentry_sdk/integrations/aiohttp.py#L80-L83
    # https://github.com/getsentry/sentry-python/blob/464ca8dda09155fcc43dfbb6fa09cf00313bf5b8/sentry_sdk/integrations/asgi.py#L90-L113
    with sentry_sdk.Hub(sentry_sdk.Hub.current) as hub:
        with hub.configure_scope() as scope:
            scope.set_tag("queue", queue_name)
            scope.set_tag("installation", installation_id_from_queue(queue_name))
        log = logger.bind(
            queue=queue_name, install=installation_id_from_queue(queue_name)
        )
        log.info("start webhook event consumer")
        while True:
            await process_webhook_event(connection, webhook_queue, queue_name, log)
async def webhook_event_consumer ( * , connection : RedisConnection , webhook_queue : RedisWebhookQueue , queue_name : str ) -> typing . NoReturn : # We need to define a custom Hub so that we can set the scope correctly. # Without creating a new hub we end up overwriting the scopes of other # consumers. # # https://github.com/getsentry/sentry-python/issues/147#issuecomment-432959196 # https://github.com/getsentry/sentry-python/blob/0da369f839ee2c383659c91ea8858abcac04b869/sentry_sdk/integrations/aiohttp.py#L80-L83 # https://github.com/getsentry/sentry-python/blob/464ca8dda09155fcc43dfbb6fa09cf00313bf5b8/sentry_sdk/integrations/asgi.py#L90-L113 with sentry_sdk . Hub ( sentry_sdk . Hub . current ) as hub : with hub . configure_scope ( ) as scope : scope . set_tag ( "queue" , queue_name ) scope . set_tag ( "installation" , installation_id_from_queue ( queue_name ) ) log = logger . bind ( queue = queue_name , install = installation_id_from_queue ( queue_name ) ) log . info ( "start webhook event consumer" ) while True : await process_webhook_event ( connection , webhook_queue , queue_name , log )