diff --git a/src/main/java/org/jenkinsci/plugins/nomad/NomadCloud.java b/src/main/java/org/jenkinsci/plugins/nomad/NomadCloud.java index ea8a4e38..59527e20 100644 --- a/src/main/java/org/jenkinsci/plugins/nomad/NomadCloud.java +++ b/src/main/java/org/jenkinsci/plugins/nomad/NomadCloud.java @@ -177,8 +177,9 @@ private void pruneOrphanedWorkers(NomadWorkerTemplate template) { String jobNamespace = worker.getJobSummary().getNamespace(); JSONObject job = this.nomad.getRunningWorker(jobSummary.getJobID(), jobNamespace); String jobRegion = job.getString("Region"); - Instant expiryTime = Instant.ofEpochMilli(job.getLong("SubmitTime")); - expiryTime.plusSeconds(this.workerTimeout * 60); + long expiryTimeMilli = job.getLong("SubmitTime")/1000000; + Instant expiryTime = Instant.ofEpochMilli(expiryTimeMilli); + expiryTime = expiryTime.plusSeconds(this.workerTimeout * 60); Instant now = Instant.now(); if (now.isAfter(expiryTime)) { LOGGER.log(Level.FINE, "Found Orphaned Node: " + worker.getID() + " in namespace " + jobNamespace + " in region " + jobRegion);