Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No exact execution start timestamp and duration #436 #439

Merged
merged 5 commits into from
Mar 24, 2024

Conversation

dprzybyl
Copy link
Collaborator

No description provided.

@@ -77,12 +77,16 @@ protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse r
return ResponseEntity.ok("Script successfully executed")
.addEntry("status", status.getStatus())
.addEntry("output", ((ExecutionStatus.FinishedSuccessfulExecution) status).getEntries())
.addEntry("path", ((ExecutionStatus.FinishedSuccessfulExecution) status).getPath());
.addEntry("path", ((ExecutionStatus.FinishedSuccessfulExecution) status).getPath())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why these casts are neeed here?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why/ how about using direct type here? if cast is used then abstraction should be dropped

public Calendar getStartTime() {
return startTime;
}

@Override
public long determineExecutionDuration() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opt-in / if you could use more dedicated types like https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html

List<ExecutionResult.Entry> entries = executionSummary.getResult().getEntries();
ExecutionResult.Entry errorEntry = executionSummary.getResult().getLastError();
if (errorEntry != null) {
return new ExecutionStatus.FinishedFailedExecution(path, entries, errorEntry);
return new ExecutionStatus.FinishedFailedExecution(path, timestamp, formattedDate, entries, errorEntry);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ExecutionXX.YyYYExecution

DRY rule violated

formattedDate = determineFormattedDate(date);
}

public static String determineFormattedDate(Calendar date) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about just format() / KISS rule ;)
fully qualified it will be DateFormatter.format instead of DateFormatter.determineFormattedDate

@dprzybyl dprzybyl merged commit 5ab35a8 into master Mar 24, 2024
1 check passed
@dprzybyl dprzybyl deleted the fix/time-format branch October 28, 2024 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants