Skip to content

Commit

Permalink
clear exisiting state before creating new one
Browse files Browse the repository at this point in the history
  • Loading branch information
heiko-braun committed Jan 15, 2024
1 parent 459ebdc commit 23e8f29
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,13 @@ def save_session(conversation):
try:
conn = psycopg2.connect(os.environ['PG_URL'])
cur = conn.cursor()


cur.execute("""
DELETE FROM slack_sessions WHERE channel=%s AND thread=%s;
""",
(conversation.get_channel(), conversation.get_thread())
)

cur.execute("""
INSERT INTO slack_sessions (channel, thread, data)
VALUES (%s, %s, %s);
Expand Down

0 comments on commit 23e8f29

Please sign in to comment.