Skip to content

Commit 8ca27df

Browse files
fix(pluto): Handle write operations inside FlatMap with Future (#187)
Co-authored-by: goncalo-frade-iohk <[email protected]>
1 parent a6494c6 commit 8ca27df

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

EdgeAgentSDK/Pluto/Sources/PersistentStorage/DAO/CDMessageDAO+MessageStore.swift

+7-5
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,13 @@ extension CDMessageDAO: MessageStore {
4444
.first()
4545
.map { $0.first }
4646
.flatMap { pair in
47-
self.updateOrCreate(
48-
msg.id,
49-
context: writeContext
50-
) { cdobj, _ in
51-
try cdobj.fromDomain(msg: msg, direction: direction, pair: pair)
47+
Future {
48+
self.updateOrCreate(
49+
msg.id,
50+
context: writeContext
51+
) { cdobj, _ in
52+
try cdobj.fromDomain(msg: msg, direction: direction, pair: pair)
53+
}
5254
}
5355
}
5456
.map { _ in }

0 commit comments

Comments
 (0)