Skip to content

Commit

Permalink
fix bug when no changes are attempted to save
Browse files Browse the repository at this point in the history
  • Loading branch information
firestar committed Jan 6, 2024
1 parent c3ecc12 commit 8c357cf
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

group = 'com.nucleodb'
version = '1.14.3'
version = '1.14.4'

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,13 @@ private boolean saveInternal(Connection connection, String changeUUID) {
connection.versionIncrease();
List<JsonOperations> changes = null;
Connection oldConnection = connectionByUUID.get(connection.getUuid());
if(oldConnection==null){
try {
consumerResponse(null, changeUUID);
} catch (ExecutionException e) {
throw new RuntimeException(e);
}
}
JsonPatch patch = JsonDiff.asJsonPatch(fromObject(oldConnection), fromObject(connection));
try {
String json = Serializer.getObjectMapper().getOmNonType().writeValueAsString(patch);
Expand All @@ -459,6 +466,12 @@ private boolean saveInternal(Connection connection, String changeUUID) {
ConnectionUpdate updateEntry = new ConnectionUpdate(connection.getVersion(), json, changeUUID, connection.getUuid());
producer.push(updateEntry.getUuid(), updateEntry.getVersion(), updateEntry, null);
return true;
}else{
try {
consumerResponse(null, changeUUID);
} catch (ExecutionException e) {
throw new RuntimeException(e);
}
}
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,12 @@ private boolean saveInternal(DataEntry entry, String changeUUID) {
Update updateEntry = new Update(changeUUID, entry, json);
producer.push(updateEntry.getKey(), updateEntry.getVersion(), updateEntry, null);
return true;
}else{
try {
consumerResponse(null, changeUUID);
} catch (ExecutionException e) {
throw new RuntimeException(e);
}
}
} catch (JsonProcessingException e) {
e.printStackTrace();
Expand Down

0 comments on commit 8c357cf

Please sign in to comment.