sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From romb...@apache.org
Subject [sling-org-apache-sling-event] 17/26: SLING-7027: Fix eta calculation for jobs and make sure we use the new eta on an updated.
Date Fri, 20 Oct 2017 14:38:04 GMT
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-event.git

commit a98f6bd4c5291795d27780880bffc2210039d3bf
Author: Karl Pauls <pauls@apache.org>
AuthorDate: Fri Aug 4 12:54:08 2017 +0000

    SLING-7027: Fix eta calculation for jobs and make sure we use the new eta on an updated.
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1804116 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/sling/event/impl/jobs/JobImpl.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/event/impl/jobs/JobImpl.java b/src/main/java/org/apache/sling/event/impl/jobs/JobImpl.java
index 5514ebf..c95aaef 100644
--- a/src/main/java/org/apache/sling/event/impl/jobs/JobImpl.java
+++ b/src/main/java/org/apache/sling/event/impl/jobs/JobImpl.java
@@ -278,7 +278,7 @@ public class JobImpl implements Job, Comparable<JobImpl> {
             final Calendar now = Calendar.getInstance();
             final long elapsed = now.getTimeInMillis() - this.getProcessingStarted().getTimeInMillis();
 
-            final long eta = elapsed * steps / step;
+            final long eta = System.currentTimeMillis() + (elapsed / current) * (steps -
current);
             now.setTimeInMillis(eta);
             this.setProperty(Job.PROPERTY_JOB_PROGRESS_ETA, now);
             return new String[] {Job.PROPERTY_JOB_PROGRESS_STEP, Job.PROPERTY_JOB_PROGRESS_ETA};
@@ -291,7 +291,7 @@ public class JobImpl implements Job, Comparable<JobImpl> {
             final Date finishDate = new Date(System.currentTimeMillis() + eta * 1000);
             final Calendar finishCal = Calendar.getInstance();
             finishCal.setTime(finishDate);
-            this.setProperty(Job.PROPERTY_JOB_PROGRESS_ETA, eta);
+            this.setProperty(Job.PROPERTY_JOB_PROGRESS_ETA, finishCal);
         } else {
             this.properties.remove(Job.PROPERTY_JOB_PROGRESS_ETA);
         }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <commits@sling.apache.org>.

Mime
View raw message