You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use the Spring Boot Actuator GET /actuator/togglz and POST /actuator/togglz/TOGGLE endpoints to view and update our toggles paired with ApplicationEventPublisherRepository and CachingStateRepository.
In our scenario we first list the toggles via GET /actuator/togglz and then update them afterwards via POST /actuator/togglz/TOGGLE.
TogglzEndpoint#getAllFeatures will load them into the cache upon GET /actuator/togglz
In case we now invoke setFeatureState on ApplicationEventPublisherRepository (which in our case delegates to CachingStateRepository) it will first get the object to determine its previous state
However, since the passed in featureState is the actual object in the cache and previousFeatureState is taken from the cache they are the exact same object and thus the state of previousFeatureState is faulty.
My proposal is therefore to adapt CachingStateRepository#getFeatureState to return not the actual cached FeatureState object, but a copy of it.
The text was updated successfully, but these errors were encountered:
We use the Spring Boot Actuator
GET /actuator/togglz
andPOST /actuator/togglz/TOGGLE
endpoints to view and update our toggles paired withApplicationEventPublisherRepository
andCachingStateRepository
.In our scenario we first list the toggles via
GET /actuator/togglz
and then update them afterwards viaPOST /actuator/togglz/TOGGLE
.TogglzEndpoint#getAllFeatures
will load them into the cache uponGET /actuator/togglz
The subsequent call to update it will first load it from the cache, set the
enabled
flag and then update it again.In case we now invoke
setFeatureState
onApplicationEventPublisherRepository
(which in our case delegates toCachingStateRepository
) it will first get the object to determine its previous stateHowever, since the passed in
featureState
is the actual object in the cache andpreviousFeatureState
is taken from the cache they are the exact same object and thus the state ofpreviousFeatureState
is faulty.My proposal is therefore to adapt
CachingStateRepository#getFeatureState
to return not the actual cachedFeatureState
object, but a copy of it.The text was updated successfully, but these errors were encountered: