Skip to content

Commit

Permalink
Merge pull request #2560 from dbluhm/fix/cleanup-requests-and-invites
Browse files Browse the repository at this point in the history
fix: clean up requests and invites
  • Loading branch information
swcurran authored Oct 24, 2023
2 parents b8c00ec + 2ea7886 commit 84df2f1
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion aries_cloudagent/connections/models/conn_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,14 +522,24 @@ async def delete_record(self, session: ProfileSession):
"""
await super().delete_record(session)

storage = session.inject(BaseStorage)
# Delete metadata
if self.connection_id:
storage = session.inject(BaseStorage)
await storage.delete_all_records(
self.RECORD_TYPE_METADATA,
{"connection_id": self.connection_id},
)

# Delete attached messages
await storage.delete_all_records(
self.RECORD_TYPE_REQUEST,
{"connection_id": self.connection_id},
)
await storage.delete_all_records(
self.RECORD_TYPE_INVITATION,
{"connection_id": self.connection_id},
)

async def abandon(self, session: ProfileSession, *, reason: Optional[str] = None):
"""Set state to abandoned."""
reason = reason or "Connectin abandoned"
Expand Down

0 comments on commit 84df2f1

Please sign in to comment.