Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup of temporary workspaces by schreduler instead of startup #14561

Merged
merged 5 commits into from
Sep 17, 2019
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 @@ -140,6 +140,10 @@ che.workspace.activity_check_scheduler_period_s=60
# inactivity timeout.
che.workspace.activity_check_scheduler_delay_s=180

# Period of stopped temporary workspaces cleanup job execution.
che.workspace.cleanup_temporary_initial_delay_min=5
che.workspace.cleanup_temporary_period_min=180

# Number of sequential successful pings to server after which it is treated as available.
# Note: the property is common for all servers e.g. workspace agent, terminal, exec etc.
che.workspace.server.ping_success_threshold=1
Expand Down
4 changes: 4 additions & 0 deletions wsmaster/che-core-api-workspace/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-commons-lang</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-commons-schedule</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-commons-tracing</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
import static org.slf4j.LoggerFactory.getLogger;

import com.google.common.annotations.VisibleForTesting;
import javax.annotation.PostConstruct;
import java.util.concurrent.TimeUnit;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.eclipse.che.api.core.Pages;
import org.eclipse.che.api.core.ServerException;
import org.eclipse.che.api.core.model.workspace.WorkspaceStatus;
import org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl;
import org.eclipse.che.api.workspace.server.spi.WorkspaceDao;
import org.eclipse.che.commons.schedule.ScheduleDelay;
import org.slf4j.Logger;

/**
Expand All @@ -43,7 +44,10 @@ public TemporaryWorkspaceRemover(WorkspaceDao workspaceDao, WorkspaceRuntimes ru
this.runtimes = runtimes;
}

@PostConstruct
@ScheduleDelay(
initialDelayParameterName = "che.workspace.cleanup_temporary_initial_delay_min",
delayParameterName = "che.workspace.cleanup_temporary_period_min",
unit = TimeUnit.MINUTES)
void initialize() {
try {
removeTemporaryWs();
Expand Down