Skip to content

Commit 0ea9763

Browse files
fix calculate job time cost bug
1 parent a3ad745 commit 0ea9763

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

cachecloud-web/src/main/java/com/sohu/cache/schedule/jobs/CacheBaseJob.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,13 @@ public abstract class CacheBaseJob implements Job, Serializable {
3131
public void execute(JobExecutionContext context) throws JobExecutionException {
3232
long start = System.currentTimeMillis();
3333
this.action(context);
34-
long end = System.currentTimeMillis();
35-
long cost = (start - end);
34+
long cost = System.currentTimeMillis() - start;
3635
if (cost > 2000) {
3736
logger.warn("slowJob: job: {}, trigger: {}, cost: {} ms", context.getJobDetail().getKey(),
38-
context.getTrigger().getKey(), (end - start));
37+
context.getTrigger().getKey(), cost);
3938
} else {
4039
logger.debug("job: {}, trigger: {}, cost: {} ms", context.getJobDetail().getKey(),
41-
context.getTrigger().getKey(), (end - start));
40+
context.getTrigger().getKey(), cost);
4241
}
4342
}
4443
}

0 commit comments

Comments
 (0)