ioBroker / ioBroker.simple-api

HTTP-API Interface to read and write objets and states
MIT License
41 stars 19 forks source link

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

Open raintonr opened 1 year ago

raintonr commented 1 year ago

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.

Apollon77 commented 1 year ago

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

raintonr commented 1 year ago

Very easy to reproduce:

raintonr commented 1 year ago

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 commented 7 months ago

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