Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,9 @@ che.workspace.plugin_broker.image=eclipse/che-plugin-broker:latest
# plugins dependencies to a workspace
che.workspace.plugin_broker.pull_policy=Always

# Defines the timeout in minutes that limits the max period of result waiting for plugin broker.
che.workspace.plugin_broker.wait_timeout_min=3

# Workspace tooling plugins registry endpoint. Should be a valid HTTP URL.
# Example: http://che-plugin-registry-eclipse-che.192.168.65.2.nip.io
# In case Che plugins tooling is not needed value 'NULL' should be used
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.util.List;
import java.util.concurrent.CompletableFuture;
import javax.inject.Inject;
import javax.inject.Named;
import org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity;
import org.eclipse.che.api.core.notification.EventService;
import org.eclipse.che.api.workspace.server.spi.InfrastructureException;
Expand Down Expand Up @@ -43,6 +44,7 @@
@Beta
public class PluginBrokerManager<E extends KubernetesEnvironment> {

private final int pluginBrokerWaitingTimeout;
private final KubernetesNamespaceFactory factory;
private final EventService eventService;
private final WorkspaceVolumesStrategy volumesStrategy;
Expand All @@ -55,12 +57,14 @@ public PluginBrokerManager(
EventService eventService,
KubernetesEnvironmentProvisioner<E> environmentProvisioner,
WorkspaceVolumesStrategy volumesStrategy,
BrokerEnvironmentFactory<E> brokerEnvironmentConfig) {
BrokerEnvironmentFactory<E> brokerEnvironmentConfig,
@Named("che.workspace.plugin_broker.wait_timeout_min") int pluginBrokerWaitingTimeout) {
this.factory = factory;
this.eventService = eventService;
this.volumesStrategy = volumesStrategy;
this.brokerEnvironmentConfig = brokerEnvironmentConfig;
this.environmentProvisioner = environmentProvisioner;
this.pluginBrokerWaitingTimeout = pluginBrokerWaitingTimeout;
}

/**
Expand Down Expand Up @@ -105,6 +109,6 @@ private DeployBroker getDeployBrokerPhase(
}

private WaitBrokerResult getWaitBrokerPhase(CompletableFuture<List<ChePlugin>> toolingFuture) {
return new WaitBrokerResult(toolingFuture);
return new WaitBrokerResult(toolingFuture, pluginBrokerWaitingTimeout);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,19 @@ public class WaitBrokerResult extends BrokerPhase {

private final CompletableFuture<List<ChePlugin>> toolingFuture;

public WaitBrokerResult(CompletableFuture<List<ChePlugin>> toolingFuture) {
private final int resultWaitingTimeout;

public WaitBrokerResult(
CompletableFuture<List<ChePlugin>> toolingFuture, int resultWaitingTimeout) {

this.toolingFuture = toolingFuture;
this.resultWaitingTimeout = resultWaitingTimeout;
}

@Override
public List<ChePlugin> execute() throws InfrastructureException {
try {
return toolingFuture.get(3, TimeUnit.MINUTES);
return toolingFuture.get(resultWaitingTimeout, TimeUnit.MINUTES);
} catch (InterruptedException e) {
throw new InfrastructureException(
"Plugins installation process was interrupted. Error: " + e.getMessage(), e);
Expand Down