Skip to content

Commit

Permalink
Merge pull request #2240 from sicpa-dlab/fix/did-exchange-cache
Browse files Browse the repository at this point in the history
fix: only cache completed connection targets
  • Loading branch information
swcurran authored Jun 1, 2023
2 parents 671d893 + 02ab735 commit a1ec0b7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion aries_cloudagent/protocols/connections/v1_0/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,13 @@ async def get_connection_targets(

targets = await self.fetch_connection_targets(connection)

await entry.set_result([row.serialize() for row in targets], 3600)
if connection.state == ConnRecord.State.COMPLETED.rfc160:
# Only set cache if connection has reached completed state
# Otherwise, a replica that participated early in exchange
# may have bad data set in cache.
await entry.set_result(
[row.serialize() for row in targets], 3600
)
else:
targets = await self.fetch_connection_targets(connection)
return targets
Expand Down

0 comments on commit a1ec0b7

Please sign in to comment.