fix: Don't load _all_ the workspaces into memory (#40810)
This commit is contained in:
parent
39636498ce
commit
fccba12b4f
|
|
@ -2,7 +2,6 @@ package com.appsmith.server.helpers.ce;
|
||||||
|
|
||||||
import com.appsmith.server.configurations.CloudServicesConfig;
|
import com.appsmith.server.configurations.CloudServicesConfig;
|
||||||
import com.appsmith.server.domains.Plugin;
|
import com.appsmith.server.domains.Plugin;
|
||||||
import com.appsmith.server.domains.Workspace;
|
|
||||||
import com.appsmith.server.dtos.ResponseDTO;
|
import com.appsmith.server.dtos.ResponseDTO;
|
||||||
import com.appsmith.server.plugins.base.PluginService;
|
import com.appsmith.server.plugins.base.PluginService;
|
||||||
import com.appsmith.server.services.ConfigService;
|
import com.appsmith.server.services.ConfigService;
|
||||||
|
|
@ -86,23 +85,23 @@ public class PluginScheduledTaskUtilsCEImpl implements PluginScheduledTaskUtilsC
|
||||||
|
|
||||||
// Save new data for this plugin,
|
// Save new data for this plugin,
|
||||||
// then make sure to install to workspaces in case the default installation flag changed
|
// then make sure to install to workspaces in case the default installation flag changed
|
||||||
final Mono<List<Workspace>> updatedPluginsWorkspaceFlux = pluginService
|
final Mono<Void> updatePluginsStep = pluginService
|
||||||
.saveAll(updatablePlugins)
|
.saveAll(updatablePlugins)
|
||||||
.filter(Plugin::getDefaultInstall)
|
.filter(Plugin::getDefaultInstall)
|
||||||
.collectList()
|
.collectList()
|
||||||
.flatMapMany(pluginService::installDefaultPlugins)
|
.flatMapMany(pluginService::installDefaultPlugins)
|
||||||
.collectList();
|
.then();
|
||||||
|
|
||||||
// Create plugin,
|
// Create plugin,
|
||||||
// then install to all workspaces if default installation is turned on
|
// then install to all workspaces if default installation is turned on
|
||||||
final Mono<List<Workspace>> workspaceFlux = Flux.fromIterable(insertablePlugins)
|
final Mono<Void> insertPluginsStep = Flux.fromIterable(insertablePlugins)
|
||||||
.flatMap(pluginService::create)
|
.flatMap(pluginService::create)
|
||||||
.filter(Plugin::getDefaultInstall)
|
.filter(Plugin::getDefaultInstall)
|
||||||
.collectList()
|
.collectList()
|
||||||
.flatMapMany(pluginService::installDefaultPlugins)
|
.flatMapMany(pluginService::installDefaultPlugins)
|
||||||
.collectList();
|
.then();
|
||||||
|
|
||||||
return updatedPluginsWorkspaceFlux.zipWith(workspaceFlux).then();
|
return updatePluginsStep.then(insertPluginsStep).then();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user