Commit 0d622081 authored by Ľuboslav Pivarč's avatar Ľuboslav Pivarč
Browse files

fixed extand -> extand from schedule not now

parent c12b9474
......@@ -23,6 +23,7 @@ import java.util.UUID;
@Service
public class KubernetesImpl implements CBioOnDemandService {
public static final int MS_TO_SEC = 1000;
private final long TIME_TO_LIVE = Utils.HOUR * 4;
private KubernetesCalls api;
......@@ -419,8 +420,12 @@ public class KubernetesImpl implements CBioOnDemandService {
if (!result.isEmpty()){
V1beta1CronJob job = result.get(0);
long expire = new Date().getTime() + instance.getSecondsToExpire();
setSchedule(job, expire);
long expireInSec = Utils.getExpireTimeFromCronExpresion(job.getSpec().getSchedule());
expireInSec = expireInSec + instance.getSecondsToExpire();
long newSchedule = new Date().getTime();
newSchedule += expireInSec * MS_TO_SEC;
setSchedule(job, newSchedule);
if(api.updateCronJob(job, NAMESPACE))
return instance;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment