Skip to content

Commit e0ea880

Browse files
committed
CLOUDSTACK-7595: Remove unnecessary multiply factor for job expiry
Backported using a6ee411 by Koushik Das <koushik@apache.org> CLOUDSTACK-7595: Config parameters "job.expire.minutes" and "job.cancel.threshold.minutes" incorrectly getting multiplied by a factor of 60 Removed the unnecessary multiply factor for both the config parameters. Also removed the duplicate entries from Config.java as these are not required Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 4e33d35 commit e0ea880

2 files changed

Lines changed: 7 additions & 10 deletions

File tree

‎framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import org.apache.log4j.Logger;
3737

3838
import org.apache.cloudstack.api.ApiErrorCode;
39-
import org.apache.cloudstack.framework.config.ConfigDepot;
4039
import org.apache.cloudstack.framework.config.ConfigKey;
4140
import org.apache.cloudstack.framework.config.Configurable;
4241
import org.apache.cloudstack.framework.jobs.AsyncJob;
@@ -82,10 +81,11 @@
8281

8382
public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager, ClusterManagerListener, Configurable {
8483
// Advanced
85-
private static final ConfigKey<Long> JobExpireMinutes = new ConfigKey<Long>(Long.class, "job.expire.minutes", "Advanced", "1440",
86-
"Time (in minutes) for async-jobs to be kept in system", true, ConfigKey.Scope.Global, 60l);
87-
private static final ConfigKey<Long> JobCancelThresholdMinutes = new ConfigKey<Long>(Long.class, "job.cancel.threshold.minutes", "Advanced", "60",
88-
"Time (in minutes) for async-jobs to be forcely cancelled if it has been in process for long", true, ConfigKey.Scope.Global, 60l);
84+
private static final ConfigKey<Long> JobExpireMinutes = new ConfigKey<Long>("Advanced", Long.class, "job.expire.minutes", "1440",
85+
"Time (in minutes) for async-jobs to be kept in system", true, ConfigKey.Scope.Global);
86+
private static final ConfigKey<Long> JobCancelThresholdMinutes = new ConfigKey<Long>("Advanced", Long.class, "job.cancel.threshold.minutes", "60",
87+
"Time (in minutes) for async-jobs to be forcely cancelled if it has been in process for long", true, ConfigKey.Scope.Global);
88+
8989

9090
private static final Logger s_logger = Logger.getLogger(AsyncJobManagerImpl.class);
9191

@@ -112,8 +112,6 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
112112
private MessageBus _messageBus;
113113
@Inject
114114
private AsyncJobMonitor _jobMonitor;
115-
@Inject
116-
private ConfigDepot _configDepot;
117115

118116
private volatile long _executionRunNumber = 1;
119117

@@ -734,8 +732,8 @@ public void reallyRun() {
734732
// limit to 100 jobs per turn, this gives cleanup throughput as 600 jobs per minute
735733
// hopefully this will be fast enough to balance potential growth of job table
736734
//1) Expire unfinished jobs that weren't processed yet
737-
List<AsyncJobVO> l = _jobDao.getExpiredUnfinishedJobs(cutTime, 100);
738-
for (AsyncJobVO job : l) {
735+
List<AsyncJobVO> unfinishedJobs = _jobDao.getExpiredUnfinishedJobs(cutTime, 100);
736+
for (AsyncJobVO job : unfinishedJobs) {
739737
s_logger.trace("Expunging unfinished job " + job);
740738
expungeAsyncJob(job);
741739
}

‎server/src/com/cloud/configuration/Config.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ public enum Config {
141141

142142
// Advanced
143143
JobExpireMinutes("Advanced", ManagementServer.class, String.class, "job.expire.minutes", "1440", "Time (in minutes) for async-jobs to be kept in system", null),
144-
JobCancelThresholdMinutes("Advanced", ManagementServer.class, String.class, "job.cancel.threshold.minutes", "60", "Time (in minutes) for async-jobs to be forcely cancelled if it has been in process for long", null),
145144
EventPurgeInterval("Advanced", ManagementServer.class, Integer.class, "event.purge.interval", "86400", "The interval (in seconds) to wait before running the event purge thread", null),
146145
AccountCleanupInterval("Advanced", ManagementServer.class, Integer.class, "account.cleanup.interval", "86400", "The interval (in seconds) between cleanup for removed accounts", null),
147146
InstanceName("Advanced", AgentManager.class, String.class, "instance.name", "VM", "Name of the deployment instance.", "instanceName"),

0 commit comments

Comments
 (0)