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 b7836d6
Show file tree
Hide file tree
Showing 2 changed files with 6 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, setup_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.on_startup.append(setup_slack_client)
app.cleanup_ctx.append(background_jobs)

app.add_routes(routes)
Expand Down
5 changes: 4 additions & 1 deletion pyslackersweb/contexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,8 @@ 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


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

0 comments on commit b7836d6

Please sign in to comment.