Skip to content

Commit

Permalink
Feed a client session to the gh app aCM
Browse files Browse the repository at this point in the history
  • Loading branch information
webknjaz committed Jan 5, 2020
1 parent a65cd78 commit 37c61fd
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions octomachinery/cli/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ async def _process_event_as_app(
from ..app.runtime.context import RUNTIME_CONTEXT
from ..app.config import BotAppConfig
from ..github.api.app_client import GitHubApp
from aiohttp.client import ClientSession
from aiohttp.web_request import Request
config = BotAppConfig.from_dotenv()
from aiohttp.http_parser import RawRequestMessage
Expand Down Expand Up @@ -148,11 +149,16 @@ class transp:
async def read_coro():
return json.dumps(event_data).encode()
http_request.read = read_coro
async with GitHubApp(config.github) as github_app:
RUNTIME_CONTEXT.github_app = ( # pylint: disable=assigning-non-slot
github_app
)
await route_github_webhook_event(http_request)
async with ClientSession() as http_client_session:
async with GitHubApp(
config.github,
http_session=http_client_session,
) as github_app:
# pylint: disable=assigning-non-slot
RUNTIME_CONTEXT.github_app = (
github_app
)
await route_github_webhook_event(http_request)


def main():
Expand Down

0 comments on commit 37c61fd

Please sign in to comment.