fabric8io / kubernetes-client

Java client for Kubernetes & OpenShift
http://fabric8.io
Apache License 2.0
3.33k stars 1.44k forks source link

Cachelock #5974

Closed shawkins closed 1 month ago

shawkins commented 1 month ago

Description

Fixes #5973

Replaces #5699 as there have been no updates there in a while. Tweaks the previous pr to address the concerns mentioned in the review and to limit global locking to only methods that mutate the indexes / index functions.

Also some minor refactoring to make the CacheImpl logic a little more streamlined.

Type of change

Checklist

manusa commented 1 month ago

For some reason, there are tests failing. However, none of the modified production code seems to be related to these failures.

shawkins commented 1 month ago

For some reason, there are tests failing. However, none of the modified production code seems to be related to these failures.

There was a subtle change that indexes used to allow null keys before, and now they don't with this code - I hadn't fully paid attention to a null check that was added in the previous pr. It seems like we should preserve that behavior, so I'll make an update.

shawkins commented 1 month ago

@manusa this looks better, but still hit some test flakiness.

shawkins commented 1 month ago

@manusa should be good now. That test really wasn't of much use, so it's been removed. I did preserve the use of the concurrenthashmap for the index, but didn't see it made much difference of a synchronized map as we're never doing any iteration.

sonarcloud[bot] commented 1 month ago

Quality Gate Failed Quality Gate failed

Failed conditions
60.3% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud