0

I am using PCF provided config server instance which is backed by GIT based repo to server properties. My application is connected to this config server service instance and exposing "refresh" endpoint. Everything works except when i change the property in git and send http post to my application (/actuator/refresh) immediately after updating property, i do not get updated prop name back in response. If I wait few seconds and then send that http post again to refresh the property then I am getting back the name of the property being updated.

Why do I have to wait few seconds(usually 1- 2min) before my property is being refreshed? Does it have anything to do with mirror synchronization?

JoshMc
  • 10,239
  • 2
  • 19
  • 38
  • Are you sure there's not multiple instances of the app here? – tjg184 Jun 30 '21 at 15:36
  • Yes I am 100% sure there is only one instance of the app running as I am building POC. – Pritesh Patel Jun 30 '21 at 16:40
  • Is it specific properties that are not getting refreshed? – tjg184 Jun 30 '21 at 17:04
  • No, let me make it clear, Property is getting refreshed but only problem is i have to wait about 2min before /actuator/refresh on client app returns updated property. Means I updated prop in git and if i immediately send refresh on client app then i dont see new value. If I wait for 2 min and then send refresh then i see client has new value. I dont know why I have to wait for around 2min to get it resolved. – Pritesh Patel Jun 30 '21 at 17:37
  • I understand. Check this one out as you didn't mention version. https://stackoverflow.com/questions/49363043/spring-boot-2-refresh-properties-on-the-fly-not-working – tjg184 Jun 30 '21 at 18:09
  • I dont think so version is the issue as i am on spring boot 2.3.4 release with cloud version Hoxton.RELEASE which is compatible with spring boot 2.3.x – Pritesh Patel Jun 30 '21 at 18:23

2 Answers2

0

If you have multiple instances of the application, you will need to either hit every application instance (AI in PCF) or use something like the following to connect the applications via an event bus.

https://spring.io/projects/spring-cloud-bus

tjg184
  • 4,508
  • 1
  • 27
  • 54
0

Is your config server resides outside PCF? Can you plz check if there is any caching for a short period of time. usually TTL is upto 30-120sec and that could be happening.

If you are using spring cloud config then you may need to check the refreshRate set. Usually config server fetches updated configuration data from Git backend by using spring.cloud.config.server.git.refreshRate

arjain13
  • 556
  • 3
  • 9