From 4e79f0ac11227b39a1825cbaecd0a0fba7720d41 Mon Sep 17 00:00:00 2001 From: goncalo-frade-iohk Date: Wed, 16 Apr 2025 12:43:16 +0100 Subject: [PATCH] fix: a bug was introduced that was not capture in the tests, having this inside a future does not run unfortunatelly. Changed to a batchUpdate to see if it handles better and does not crash Signed-off-by: goncalo-frade-iohk --- .../DAO/CDMessageDAO+MessageStore.swift | 12 +++++------- build_test.sh | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/EdgeAgentSDK/Pluto/Sources/PersistentStorage/DAO/CDMessageDAO+MessageStore.swift b/EdgeAgentSDK/Pluto/Sources/PersistentStorage/DAO/CDMessageDAO+MessageStore.swift index 4bc15964..080c2789 100644 --- a/EdgeAgentSDK/Pluto/Sources/PersistentStorage/DAO/CDMessageDAO+MessageStore.swift +++ b/EdgeAgentSDK/Pluto/Sources/PersistentStorage/DAO/CDMessageDAO+MessageStore.swift @@ -44,13 +44,11 @@ extension CDMessageDAO: MessageStore { .first() .map { $0.first } .flatMap { pair in - Future { - self.updateOrCreate( - msg.id, - context: writeContext - ) { cdobj, _ in - try cdobj.fromDomain(msg: msg, direction: direction, pair: pair) - } + self.batchUpdateOrCreate( + [msg.id], + context: writeContext + ) { id, cdobj, _ in + try cdobj.fromDomain(msg: msg, direction: direction, pair: pair) } } .map { _ in } diff --git a/build_test.sh b/build_test.sh index 6c85acaf..faf66ad2 100755 --- a/build_test.sh +++ b/build_test.sh @@ -3,7 +3,7 @@ set -e DERIVED_DATA_DIR="$HOME/.derivedData" -DESTINATION="platform=iOS Simulator,name=IPhone 14" +DESTINATION="platform=iOS Simulator,name=iPhone 16" SCHEME="EdgeAgentSDK-Package" LCOV_DIR="$DERIVED_DATA_DIR/lcov"