Skip to content

Conversation

Copy link

Copilot AI commented Nov 2, 2025

Addresses performance feedback from PR #57: SecureRandom instantiation on every invoice generation is expensive.

Changes

  • MockLnServer: Made SecureRandom a static final field instead of creating new instances in generateValidBolt11Invoice()
  • .gitignore: Fixed pattern to exclude all target/ directories, not just root-level
// Before: new instance on every call
private String generateValidBolt11Invoice() {
    SecureRandom random = new SecureRandom();
    // ...
}

// After: shared thread-safe instance
public class MockLnServer {
    private static final SecureRandom SECURE_RANDOM = new SecureRandom();
    
    private String generateValidBolt11Invoice() {
        // uses SECURE_RANDOM
    }
}

SecureRandom is thread-safe and initialization involves entropy gathering, making this a meaningful optimization for high-throughput scenarios.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits November 2, 2025 21:34
Co-authored-by: tcheeric <6341500+tcheeric@users.noreply.github.com>
Co-authored-by: tcheeric <6341500+tcheeric@users.noreply.github.com>
Copy link
Author

Copilot AI commented Nov 2, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • maven.398ja.xyz
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.11/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.11/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.11 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.11/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/phoenixd-java/phoenixd-java org.codehaus.plexus.classworlds.launcher.Launcher clean compile -pl phoenixd-mock -am (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] WIP address feedback from PR #57 on Release/0.1.4 perf: reuse SecureRandom instance in MockLnServer Nov 2, 2025
Copilot AI requested a review from tcheeric November 2, 2025 21:36
@tcheeric tcheeric marked this pull request as ready for review November 2, 2025 21:40
@tcheeric tcheeric merged commit 3acd782 into release/0.1.4 Nov 2, 2025
1 check passed
@tcheeric tcheeric deleted the copilot/sub-pr-57 branch November 2, 2025 21:40
@github-actions
Copy link

github-actions bot commented Nov 2, 2025

Qodana Community for JVM

2 new problems were found

Inspection name Severity Problems
AutoCloseable used without 'try'-with-resources 🔶 Warning 1
Simplifiable conditional expression 🔶 Warning 1

☁️ View the detailed Qodana report

Contact Qodana team

Contact us at qodana-support@jetbrains.com

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