ioBroker.simple-api icon indicating copy to clipboard operation
ioBroker.simple-api copied to clipboard

Cache of 'not found' datapoints should be cleared periodically or not even exist

Open raintonr opened this issue 2 years ago • 4 comments

I have an external system which polls simple-api to read state values. This happens to be reading values from a sensor which is itself polled by the RPI2 adapter. Thus the URL being polled is:

http://x.x.x.x:8087/get/rpi2.0.gpio.4.humidity

Recently I changed some hardware so modified the GPIOS in use. Because of this I manually deleted all the rpi.0.gpio... states and let the RPI2 adapter re-create as I configure them one by one.

During this time I have not touched Simple API or the system polling Simple API.

When I eventually reconnected a sensor to GPIO4 I found that Simple API was returning a datapoint not found error even though the state is visible in the admin interface.

It seems that Simple API has cached the fact that rpi2.0.gpio.4.humidity does not exist. Initially it correctly returns datapoint not found but once the state springs into existence it's value should be returned. This does not happen.

Only upon restart of Simple API adapter is the value finally returned.

It is very frustrating to hit a URL expecting Simple API to return a state which can clearly be seen to exist in the admin interface only to be told that state does not exist. I get that valid IDs are cached but think caching invalid data is not useful.

raintonr avatar Feb 11 '23 10:02 raintonr

Please provide a debug log of such a case. I would not know of any case like this

Apollon77 avatar Feb 11 '23 13:02 Apollon77

Very easy to reproduce:

  • Hit Simple API asking for an unknown state. Ie. http://yourIoB:8087/get/0_userdata.0.testing
  • datapoint "0_userdata.0.testing" not found returned as expected.
  • Create 0_userdata.0.testing.
  • Request 0_userdata.0.testing again.
  • datapoint "0_userdata.0.testing" not found returned in error.
  • Restart Simple API
  • Request 0_userdata.0.testing again.
  • Now the state is correctly returned.

raintonr avatar Feb 14 '23 16:02 raintonr

Happened again today when I added a new state and tried to update via Simple API got a 'not found' response and had to restart the adapter.

raintonr avatar Jul 25 '23 10:07 raintonr

... and again today when I added a new user state.

raintonr avatar Dec 15 '23 07:12 raintonr