redis / lettuce

Advanced Java Redis client for thread-safe sync, async, and reactive usage. Supports Cluster, Sentinel, Pipelining, and codecs.
https://lettuce.io
MIT License
5.3k stars 949 forks source link

Make connection initialize flag works as expected #2835

Open YorigamiShion opened 2 months ago

YorigamiShion commented 2 months ago

I think flag atomicBoolean here is expected to make sure only one thread executes sync.getConncetion().whenComplete to remove the Sync from map when init is fail. However, the original implmentation will allow all threads execute whenComplete if the connection is not initialized. Furthermore, call connections.get then connections.computeIfAbsent is unnecessary.

Make sure that:

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 77.69%. Comparing base (43843bf) to head (004b471). Report is 251 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2835 +/- ## ============================================ - Coverage 78.71% 77.69% -1.03% - Complexity 6786 7236 +450 ============================================ Files 508 539 +31 Lines 22765 24492 +1727 Branches 2446 2606 +160 ============================================ + Hits 17919 19028 +1109 - Misses 3717 4266 +549 - Partials 1129 1198 +69 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

mp911de commented 2 months ago

Care to elaborate what kind of issue you're addressing before we jump right into the code?