Skip to content

Commit

Permalink
does it work ?
Browse files Browse the repository at this point in the history
  • Loading branch information
ovv committed Jun 20, 2019
1 parent 77901e1 commit 9fcc1d0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pyslackersweb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from sentry_sdk.integrations.aiohttp import AioHttpIntegration
from sentry_sdk.integrations.logging import LoggingIntegration

from .contexts import background_jobs, client_session
from .contexts import background_jobs, client_session, slack_client
from .filters import formatted_number
from .middleware import request_context_middleware
from .views import routes # , on_oauth2_login
Expand Down Expand Up @@ -60,6 +60,7 @@ async def app_factory() -> web.Application:
)

app.cleanup_ctx.append(client_session)
app.cleanup_ctx.append(slack_client)
app.cleanup_ctx.append(background_jobs)

app.add_routes(routes)
Expand Down
6 changes: 5 additions & 1 deletion pyslackersweb/contexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,9 @@ async def background_jobs(app: web.Application) -> None:
async def client_session(app: web.Application) -> None:
async with ClientSession(raise_for_status=True) as session:
app["client_session"] = session
app["slack_client"] = SlackAPI(token=app["slack_token"], session=session)
yield


async def slack_client(app: web.Application) -> None:
app["slack_client"] = SlackAPI(token=app["slack_token"], session=app["client_session"])
yield

0 comments on commit 9fcc1d0

Please sign in to comment.