mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-28 02:17:53 +00:00
fix(gql): removing data platform caching in gql (#2947)
This commit is contained in:
parent
6135eed757
commit
49093ea1ce
@ -16,7 +16,6 @@ import java.util.stream.Collectors;
|
||||
public class DataPlatformType implements EntityType<DataPlatform> {
|
||||
|
||||
private final DataPlatforms _dataPlatformsClient;
|
||||
private Map<String, DataPlatform> _urnToPlatform;
|
||||
|
||||
public DataPlatformType(final DataPlatforms dataPlatformsClient) {
|
||||
_dataPlatformsClient = dataPlatformsClient;
|
||||
@ -30,13 +29,12 @@ public class DataPlatformType implements EntityType<DataPlatform> {
|
||||
@Override
|
||||
public List<DataFetcherResult<DataPlatform>> batchLoad(final List<String> urns, final QueryContext context) {
|
||||
try {
|
||||
if (_urnToPlatform == null) {
|
||||
_urnToPlatform = _dataPlatformsClient.getAllPlatforms().stream()
|
||||
.map(DataPlatformMapper::map)
|
||||
.collect(Collectors.toMap(DataPlatform::getUrn, platform -> platform));
|
||||
}
|
||||
Map<String, DataPlatform> urnToPlatform = _dataPlatformsClient.getAllPlatforms()
|
||||
.stream()
|
||||
.map(DataPlatformMapper::map)
|
||||
.collect(Collectors.toMap(DataPlatform::getUrn, platform -> platform));
|
||||
return urns.stream()
|
||||
.map(key -> _urnToPlatform.containsKey(key) ? _urnToPlatform.get(key) : getUnknownDataPlatform(key))
|
||||
.map(key -> urnToPlatform.containsKey(key) ? urnToPlatform.get(key) : getUnknownDataPlatform(key))
|
||||
.map(dataPlatform -> DataFetcherResult.<DataPlatform>newResult().data(dataPlatform).build())
|
||||
.collect(Collectors.toList());
|
||||
} catch (Exception e) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user