-
Notifications
You must be signed in to change notification settings - Fork 528
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
Optimizations to REST API #1323
Conversation
…lliseconds to export
It will be cached and the action lookup here wont happen
@vivek I am not sure how to interpret the failure here - is it just saying I need more tests? |
@i386 look in |
@@ -44,12 +44,26 @@ | |||
/*package*/ final Map<Class, Model> models = new ConcurrentHashMap<Class, Model>(); | |||
|
|||
public <T> Model<T> get(Class<T> type) throws NotExportableException { | |||
if (type.getAnnotation(ExportedBean.class) == null) { |
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.
Directly updating stapler imported code? This can leave us with pain later on, better to submit PR on stapler then we import them over here.
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.
try { | ||
model = owner.get(d.getClass(), parent.type, name); | ||
} catch (NotExportableException e) { | ||
if (d.getClass().getAnnotation(ExportedBean.class) == null) { |
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.
Same as above, lets not update stapler code directly here. Please open a PR on stapler.
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.
See above
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.
Changes in Property.java in this PR is different from the ones in PR. I think its cleaner to remove changes from here and merge stapler changes in separate PR, after stapler PR is merged. This way we can merge this PR without waiting for stapler changes and get immediate perf benefits.
@@ -53,7 +56,7 @@ | |||
|
|||
/** Date String format */ | |||
public static final String DATE_FORMAT_STRING = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"; | |||
|
|||
public static final DateTimeFormatter DATE_FORMAT = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); |
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 we move joda specific code to AbstractRunImpl? This will also result in to blue-rest
module not to depend on specific data time library.
blueocean-rest/pom.xml
Outdated
@@ -23,6 +23,10 @@ | |||
<groupId>io.jenkins.blueocean.rest.annotation</groupId> | |||
<artifactId>capability-annotation</artifactId> | |||
</dependency> | |||
<dependency> |
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.
See my other comment, we should avoid depending on specific date time library in models.
@@ -97,6 +96,21 @@ public Date getEndTime() { | |||
} | |||
|
|||
@Override | |||
public String getStartTimeString() { |
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.
Maybe declare these as abstract? default implementation returning null can be misleading.
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.
WDYM?
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.
Ignore that comment, for some reason I mistook it as one of the model class. All good here:)
Not sure about the build failure, is this a test coverage failure?
?? (jacoco seems annoying in every single way, except that it does enforce coverage levels) |
@michaelneale it means there are 3 classes without test coverage. Reports are in that modules |
@vivek the only class I can see that does not have coverage is |
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.
Other than stapler changes, rest of the code looks good. There was a minor comment I left to log error message in case of loading value from callable.
Maybe we should remove stapler enhancement from here if we don't want to wait for stapler PR to merge and deal with it in separate PR?
try { | ||
model = owner.get(d.getClass(), parent.type, name); | ||
} catch (NotExportableException e) { | ||
if (d.getClass().getAnnotation(ExportedBean.class) == null) { |
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.
Changes in Property.java in this PR is different from the ones in PR. I think its cleaner to remove changes from here and merge stapler changes in separate PR, after stapler PR is merged. This way we can merge this PR without waiting for stapler changes and get immediate perf benefits.
@@ -97,6 +96,21 @@ public Date getEndTime() { | |||
} | |||
|
|||
@Override | |||
public String getStartTimeString() { |
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.
Ignore that comment, for some reason I mistook it as one of the model class. All good here:)
} | ||
}).orNull(); | ||
} catch (ExecutionException e) { | ||
return null; |
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 log error message or else the checked exception thrown by value loaded callable will be silently ignored.
@i386 since we don't have coverage report archived, if you build that module locally (Where its reporting coverage error) you should be able to see the index.html (target/code-coverage/report/index.html) and see which classes lack coverage (it includes anonymous inner classes as well). |
@vivek I have removed the stapler changes from here. We can add them back when jenkinsci/stapler#127 is merged. |
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 🐝
Description
Serving this request took 75ms. It now takes 30ms.
Submitter checklist
Reviewer checklist