-
Notifications
You must be signed in to change notification settings - Fork 521
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
Adding total timeout to task models #313
Adding total timeout to task models #313
Conversation
95851be
to
039e8af
Compare
@@ -202,6 +202,9 @@ public boolean isRetriable() { | |||
@ProtoField(id = 42) | |||
private boolean subworkflowChanged; | |||
|
|||
@ProtoField(id = 43) | |||
private long firstStartTime; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be added to equals
, hashcode
and toString
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I think we should change the hashCode to be aware of the task's PK -- which is taskName. Thoughts @jmigueprieto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@v1r3n hashCode
is considering taskDefName
@Override
public int hashCode() {
return Objects.hash(
getTaskType(),
getStatus(),
getInputData(),
getReferenceTaskName(),
getWorkflowPriority(),
getRetryCount(),
getSeq(),
getCorrelationId(),
getPollCount(),
getTaskDefName(),
...
}
Or do you want to use just "task name"?
PROS
- It will be simpler
- (small) Performance gain
CONS
- We'll need to modify
equals
: if only id is used in hashCode but equals considers additional fields, the contract will be broken. - We'll have an incomplete equality: this might break existing code e.g.: tests that assert
assertNotEquals(task0, task1)
. If both task have the same name but different fields, the assertion istrue
now but will befalse
is we just consider task name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can analyze this further in another PR. But, for the moment I believe that we should stick to considering the added fields to equals
and hashCode
/** | ||
* @return the total timeout in seconds | ||
*/ | ||
public long getTotalTimeoutSeconds() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
equals
& hashCode
?
@@ -142,11 +146,17 @@ public TaskDef(String name, String description) { | |||
this.description = description; | |||
} | |||
|
|||
public TaskDef(String name, String description, int retryCount, long timeoutSeconds) { | |||
public TaskDef( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can a new constructor be added instead of changing the signature of this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- There are changes to backend and client v4 - split this PR.
- The client changes are breaking changes. Do NOT modify the signature of existing constructors. They might be in use by someone and adding a property should NOT break existing code.
c6aaddb
to
659baf6
Compare
cc76d81
to
35fd264
Compare
cfd6396
to
31f4487
Compare
31f4487
to
f978467
Compare
return totalTimeoutSeconds; | ||
} | ||
|
||
public void setTotalTimeoutSeconds(@NotNull long totalTimeoutSeconds) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: a long
(primitive type) cannot be null. The @NotNull
is redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after NIT changes
Pull Request type
Changes in this PR
Added new parameter total task timeout to taskmodel and task def. This will be useful to timeout task if it exceeds total timeout value (including timeout in retry as well), this PR is only for model changes. Core service changes will be in another PR.