Skip to content

Commit

Permalink
feat: added tenant configuration to redis cache (#33083)
Browse files Browse the repository at this point in the history
  • Loading branch information
NilanshBansal committed May 9, 2024
1 parent 9b144b6 commit 9f37234
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,6 @@ public Mono<Tenant> fetchCachedTenant(String tenantId) {
}
return tenant;
});
// .flatMap(tenant ->
// setUserPermissionsInObject(tenant).switchIfEmpty(Mono.just(tenant)));
}

@CacheEvict(cacheName = "defaultTenant", key = "{#tenantId}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,11 @@ public Mono<Tenant> updateTenantConfiguration(String tenantId, TenantConfigurati
});
}

return envMono.then(
Mono.zip(evictTenantCache, Mono.just(oldtenantConfiguration), Mono.just(tenant)));
return envMono.then(Mono.zip(Mono.just(oldtenantConfiguration), Mono.just(tenant)));
})
.flatMap(tuple3 -> {
Tenant tenant = tuple3.getT3();
TenantConfiguration oldConfig = tuple3.getT2();
.flatMap(tuple2 -> {
Tenant tenant = tuple2.getT2();
TenantConfiguration oldConfig = tuple2.getT1();
AppsmithBeanUtils.copyNestedNonNullProperties(tenantConfiguration, oldConfig);
tenant.setTenantConfiguration(oldConfig);
return repository.updateById(tenantId, tenant, MANAGE_TENANT);
Expand Down Expand Up @@ -160,7 +159,9 @@ public Mono<Tenant> getTenantConfiguration() {
@Override
public Mono<Tenant> getDefaultTenant() {
// Fetching Tenant from cache
return getDefaultTenantId().flatMap(tenantId -> cacheableRepositoryHelper.fetchCachedTenant(tenantId));
return getDefaultTenantId()
.flatMap(tenantId -> cacheableRepositoryHelper.fetchCachedTenant(tenantId))
.flatMap(tenant -> repository.setUserPermissionsInObject(tenant).switchIfEmpty(Mono.just(tenant)));
}

@Override
Expand Down

0 comments on commit 9f37234

Please sign in to comment.