Avoid invalidating the realm when managing client initial access

Closes #42922

Signed-off-by: Alexander Schwartz <alexander.schwartz@gmx.net>
This commit is contained in:
Alexander Schwartz
2025-09-25 06:24:09 +02:00
committed by GitHub
parent a8d947b1a9
commit 6b49ffe5ee

View File

@@ -1800,28 +1800,32 @@ public class RealmAdapter implements CachedRealmModel {
@Override
public ClientInitialAccessModel createClientInitialAccessModel(int expiration, int count) {
getDelegateForUpdate();
return updated.createClientInitialAccessModel(expiration, count);
// This does not call getDelegateForUpdate() this data is never cached, and calling it would invalidate all cached realm data
return modelSupplier.get().createClientInitialAccessModel(expiration, count);
}
@Override
public ClientInitialAccessModel getClientInitialAccessModel(String id) {
return getDelegateForUpdate().getClientInitialAccessModel(id);
// This does not call getDelegateForUpdate() this data is never cached, and calling it would invalidate all cached realm data
return modelSupplier.get().getClientInitialAccessModel(id);
}
@Override
public void removeClientInitialAccessModel(String id) {
getDelegateForUpdate().removeClientInitialAccessModel(id);
// This does not call getDelegateForUpdate() this data is never cached, and calling it would invalidate all cached realm data
modelSupplier.get().removeClientInitialAccessModel(id);
}
@Override
public Stream<ClientInitialAccessModel> getClientInitialAccesses() {
return getDelegateForUpdate().getClientInitialAccesses();
// This does not call getDelegateForUpdate() this data is never cached, and calling it would invalidate all cached realm data
return modelSupplier.get().getClientInitialAccesses();
}
@Override
public void decreaseRemainingCount(ClientInitialAccessModel clientInitialAccess) {
getDelegateForUpdate().decreaseRemainingCount(clientInitialAccess);
// This does not call getDelegateForUpdate() this data is never cached, and calling it would invalidate all cached realm data
modelSupplier.get().decreaseRemainingCount(clientInitialAccess);
}
@Override