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

Remove Need to Refresh Modem Database #279

Merged
merged 6 commits into from
Dec 22, 2020

Conversation

krkeegan
Copy link
Collaborator

So this is pretty cool. I have reworked the Modem delete/add/modify routines so that they no longer care or require a refresh of the modem database. This means things like pair, sync, and adding links should no longer fail because the Modem db is out of date.

In short, if you try and add a link that already exists, the modem will return a nak. At which point we retry the action as an update instead. The same is true if you try to update a link that doesn't exist. The delete is a little more complicated and requires us to search the database first, but we can search specifically for these links.

The cool thing is that this all happens in less than a second, so it isn't even noticable to users.

The only real need to refresh the modem db now is if you want to run sync to delete extraneous entries. Otherwise, an out of date modem db shouldn't be an issue anymore.

This is also a prime example of how bad the insteon documentation is. The documentation about these commands is wrong a lot. I had to poke at things a fair bit to determine how it actually works.

I still have to write some tests to ensure that everything works as intended. But I have tested all of the various iterations on actual hardware and it works great.

Fixing errors in the Modem DB defined spec.
There is no reason we need the cache to perform an accurate DB
Delete.  It would be a much better user experience if we recoverd
from any errors in the delete.

To do this, we search for all entries that match addr and group
on the modem and remove them from the cache.  We then ask the
Modem to provide us only the entries that match addr and group
and add them back to the end of our db cache.  We then perform
the delete as we did previously, which should never result in a
NAK.
If an add is attempted and the entry already exists we get a nack
and then we attempt the same entry as an update.  The vice-versa
is true of a update as well.

This means users will no longer get the modem db is out of date
please refresh warning.
@krkeegan krkeegan merged commit d947377 into TD22057:dev Dec 22, 2020
@krkeegan krkeegan deleted the Modem_DB_Improvements branch December 31, 2020 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant