Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/idle transactions #2650

Merged
merged 5 commits into from
Nov 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/dispatch/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,7 @@ def run_slack_websocket(organization: str, project: str):
)
return

session.close()
click.secho("Slack websocket process started...", fg="blue")
asyncio.run(socket_mode.run_websocket_process(instance.configuration))

Expand Down
2 changes: 2 additions & 0 deletions src/dispatch/plugins/dispatch_slack/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ def handle_dialog_action(
action=action,
)

db_session.close()


def handle_block_action(
config: SlackConversationConfiguration, action: dict, background_tasks: BackgroundTasks
Expand Down
2 changes: 2 additions & 0 deletions src/dispatch/plugins/dispatch_slack/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ async def handle_incident_conversation_commands(config, client, request, backgro
command=request,
)

db_session.close()

return get_incident_conversation_command_message(config, command)


Expand Down
2 changes: 2 additions & 0 deletions src/dispatch/plugins/dispatch_slack/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ async def handle_slack_event(*, config, client, event, background_tasks):
event=event,
)

db_session.close()

return {"ok": ""}


Expand Down
9 changes: 7 additions & 2 deletions src/dispatch/plugins/dispatch_slack/menus.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
from dispatch.plugins.dispatch_slack.modals.common import parse_submitted_form
from dispatch.plugins.dispatch_slack.modals.incident.enums import IncidentBlockId

from .decorators import get_organization_scope_from_channel_id, get_organization_scope_from_slug
from .decorators import (
get_organization_scope_from_channel_id,
get_organization_scope_from_slug,
)

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -39,7 +42,9 @@ async def handle_slack_menu(*, config, client: WebClient, request: Request, orga
db_session = get_organization_scope_from_slug(organization)

f = menu_functions(action_id)
return f(db_session, user_id, user_email, channel_id, incident_id, query_str, request)
menu = f(db_session, user_id, user_email, channel_id, incident_id, query_str, request)
db_session.close()
mvilanova marked this conversation as resolved.
Show resolved Hide resolved
return menu


def menu_functions(action_id: str):
Expand Down
3 changes: 2 additions & 1 deletion src/dispatch/plugins/dispatch_slack/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ def verify_signature(organization: str, request_data: str, timestamp: int, signa
h = hmac.new(slack_signing_secret, req, hashlib.sha256).hexdigest()
result = hmac.compare_digest(f"v0={h}", signature)
if result:
session.close()
return p.instance.configuration

session.close()
raise HTTPException(status_code=403, detail=[{"msg": "Invalid request signature"}])


Expand Down