Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
raintonr opened this issue Feb 11, 2023 · 4 comments
Labels

Comments

@raintonr
Copy link

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
Copy link
Contributor

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

@raintonr
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants