Fixed relationship locking

This commit is contained in:
Fabio Sinibaldi 2022-09-29 16:33:33 +02:00
parent ce253b5ade
commit 7d4bb76475
1 changed files with 4 additions and 2 deletions

View File

@ -323,7 +323,9 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI<
rel.setTargetID(targetId);
rel.setTargetUCD(targetUCD);
return onUpdate(toUpdate.addRelation(rel));
toUpdate =onUpdate(toUpdate.addRelation(rel));
return unlockAndUpdate(toUpdate);
}catch(Throwable t){
log.error("Unexpected exception ",t);
unlock(toUpdate);
@ -346,7 +348,7 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI<
// update only if something changed
if(toUpdate.getRelationships().size()!=beforeSize) return onUpdate(toUpdate);
}
return toUpdate;
return unlockAndUpdate(toUpdate);
}catch(Throwable t){
log.error("Unexpected exception ",t);
unlock(toUpdate);