Skip to content

Commit

Permalink
Delete mediation record if it's not ready (#60)
Browse files Browse the repository at this point in the history
Signed-off-by: conanoc <conanoc@gmail.com>
  • Loading branch information
conanoc authored Aug 16, 2023
1 parent 3e36329 commit 66ffb19
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions AriesFramework/AriesFramework/routing/MediationRecipient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,14 @@ class MediationRecipient {
}

func requestMediationIfNecessry(connection: ConnectionRecord) async throws {
if let mediationRecord = try await repository.getDefault(), mediationRecord.isReady() {
try await initiateMessagePickup(mediator: mediationRecord)
agent.setInitialized()
return
if let mediationRecord = try await repository.getDefault() {
if mediationRecord.isReady() {
try await initiateMessagePickup(mediator: mediationRecord)
agent.setInitialized()
return
}

try await repository.delete(mediationRecord)
}

// If mediation request has not been done yet, start it.
Expand Down

0 comments on commit 66ffb19

Please sign in to comment.