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

JDK Downloader: fix current GA/EA values #6590

Conversation

mbien
Copy link
Member

@mbien mbien commented Oct 19, 2023

getLatestSts does not include LTS (obviously :)), which means the downloader thought the latest JDK was still 20 and 21 was still in EA.

(trying to find a more efficient way of running this query before RC2, since this doubles the latency)

targets delivery

before:
image

after:
image

@mbien mbien added the Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) label Oct 19, 2023
@mbien mbien added this to the NB20 milestone Oct 19, 2023
@neilcsmith-net
Copy link
Member

getLatestSts does not include LTS (obviously :))

I'm fairly sure it did at one point, which actually makes some sense - an LTS is still STS on the way!

There's also getLatest() ?

@mbien
Copy link
Member Author

mbien commented Oct 19, 2023

There's also getLatest() ?

no there is not, there is getAllMajorVersions(boolean ea), however this doesn't seem to work, if ea=false, there is still 22 in the list. I pinged hansolo himself via slack, so he is aware of this PR.

@neilcsmith-net
Copy link
Member

No, I know, I swear I was just looking at code with that method in, but certainly can't find it now. 🤷

Having a look at an alternative idea. Our library is an old release too.

@mbien
Copy link
Member Author

mbien commented Oct 19, 2023

Having a look at an alternative idea. Our library is an old release too.

testing with latest lib in a maven project, update wouldn't change anything. But we should update anyway at some point.
here a snippet:

import io.foojay.api.discoclient.DiscoClient;
import java.util.function.Supplier;
public class Disco {

    public static void main(String[] args) {
        DiscoClient client = new DiscoClient();
        System.out.println(measure(() -> client.getLatestLts(false)));
        System.out.println(measure(() -> client.getLatestSts(false)));
        System.out.println(measure(() -> client.getAllMajorVersions(false)));
        System.out.println(measure(() -> client.getAllMajorVersions(true)));
    }
    
    private static <R> R  measure(Supplier<R> s) {
        long delta = System.currentTimeMillis();
        R r = s.get();
        System.out.println("delta: "+ (System.currentTimeMillis()-delta)/1000.0f);
        return r;
        
    }
    
}

@mbien
Copy link
Member Author

mbien commented Oct 19, 2023

this works and is just one call:

        Queue<MajorVersion> versions = client.getAllMajorVersions(true);
        int latestEA = versions.stream().filter(Predicate.not(MajorVersion::isEarlyAccessOnly)).findFirst().get().getAsInt();
        int latestGA = versions.stream().filter(MajorVersion::isEarlyAccessOnly).findFirst().get().getAsInt();
        System.out.println("latest EA: "+latestEA);
        System.out.println("latest GA: "+latestGA);

will update this PR most likely

@neilcsmith-net
Copy link
Member

neilcsmith-net commented Oct 19, 2023

Came to similar conclusion. master...neilcsmith-net:netbeans:disco-nb20rc

Not sure why that method returns a Boolean but guarded against it.

Not the first time we've had issues with the EA filter being wrong.

EDIT : could also rewrite the cache in there to include the EA and filter that. master...neilcsmith-net:netbeans:disco-nb20rc2

@mbien mbien added the ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) label Oct 19, 2023
@mbien mbien force-pushed the jdk-downloader-current-version-fix_delivery branch from 86f8646 to 2582b09 Compare October 19, 2023 13:35
@mbien
Copy link
Member Author

mbien commented Oct 19, 2023

rewrote the getters to use a cached major version list to avoid api calls.

the panel should now display the main content with two api calls.

@neilcsmith-net
Copy link
Member

Looks good!

Even with using the isEarlyAccessOnly check, rather than the upstream filter, I've seen JDK 22 appear as GA twice. Presume an issue with the returned data somewhere.

use better caching to avoid per-call latency overhead
@mbien mbien force-pushed the jdk-downloader-current-version-fix_delivery branch from 2582b09 to e75a765 Compare October 19, 2023 14:48
@mbien mbien marked this pull request as ready for review October 19, 2023 14:49
@mbien
Copy link
Member Author

mbien commented Oct 19, 2023

removed redundant synchronized, moved all cached methods to the same area and other trivial updates.

The panel loads now in 3-4s, which isn't so bad.

@neilcsmith-net neilcsmith-net merged commit 9eb9def into apache:delivery Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants