Skip to content

Commit

Permalink
use LAST_RESULT_KEY
Browse files Browse the repository at this point in the history
  • Loading branch information
steinkobben committed Nov 5, 2024
1 parent e350c9f commit 5bfc0db
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public ResponseEntity<Object> details(@PathVariable TaskType type, @PathVariable
"nextFireTimes", TriggerUtils.computeFireTimes((OperableTrigger) cron, null, 5))
.putPOJO(Task.STATE_KEY, scheduler.getTriggerState(trigger.getKey()))
.putPOJO("progress", result[0])
.put("lastResult", jobDataMap.getString("lastResult"))
.put(Task.LAST_RESULT_KEY, jobDataMap.getString(Task.LAST_RESULT_KEY))
.putPOJO("jobData", jobDataMap));
} catch (SchedulerException e) {
throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, "Error getting task", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected void executeInternal(JobExecutionContext context) throws JobExecutionE
throw new UnsupportedOperationException("Failing POC task failed.");
} catch (Exception e) {
logger.error("Failing POC task failed.", e);
jobDataMap.put("lastResult", "POC task executed unsuccessfully");
jobDataMap.put(Task.LAST_RESULT_KEY, "POC task executed unsuccessfully");

Check warning on line 42 in src/main/java/org/tailormap/api/scheduling/FailingPocTask.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/tailormap/api/scheduling/FailingPocTask.java#L42

Added line #L42 was not covered by tests
context.setResult("POC task executed unsuccessfully");
throw new JobExecutionException(e);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/tailormap/api/scheduling/IndexTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ protected void executeInternal(@NonNull JobExecutionContext context)
searchIndex.setStatus(SearchIndex.Status.ERROR).setComment(e.getMessage());
persistedJobData.put("lastExecutionFinished", null);
persistedJobData.put(
"lastResult", "Index task failed with " + e.getMessage() + ". Check logs for details");
Task.LAST_RESULT_KEY, "Index task failed with " + e.getMessage() + ". Check logs for details");

Check warning on line 103 in src/main/java/org/tailormap/api/scheduling/IndexTask.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/tailormap/api/scheduling/IndexTask.java#L103

Added line #L103 was not covered by tests
searchIndexRepository.save(searchIndex);
context.setResult("Error indexing. Check logs for details.");
throw new JobExecutionException("Error indexing", e);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/tailormap/api/scheduling/PocTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected void executeInternal(@NonNull JobExecutionContext context) {
int executions = (1 + (int) mergedJobDataMap.getOrDefault("executions", 0));
jobDataMap.put("executions", executions);
jobDataMap.put("lastExecutionFinished", Instant.now());
jobDataMap.put("lastResult", "POC task executed successfully");
jobDataMap.put(Task.LAST_RESULT_KEY, "POC task executed successfully");

Check warning on line 65 in src/main/java/org/tailormap/api/scheduling/PocTask.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/tailormap/api/scheduling/PocTask.java#L65

Added line #L65 was not covered by tests
context.setResult("POC task executed successfully");

setFoo("foo executed: " + executions);
Expand Down

0 comments on commit 5bfc0db

Please sign in to comment.