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

Don't call handleDeviceAdded() on startup #66

Open
benfrancis opened this issue Dec 13, 2022 · 0 comments
Open

Don't call handleDeviceAdded() on startup #66

benfrancis opened this issue Dec 13, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@benfrancis
Copy link
Member

I've noticed that when the virtual things adapter is installed and enabled, the adapter sends a bunch of thingAdded IPC messages to the gateway on startup.

I think this is a result of this.adapter.handleDeviceAdded(this)) being called in the constructor of the VirtualThingsDevice class https:/WebThingsIO/virtual-things-adapter/blob/master/virtual-things-adapter.js#L1318

The result of this is that when the add-on starts up, it sends a thingAdded message to the gateway for each of the many virtual things exposed by the add-on. For things which have already been added to the gateway this results in its Thing Description being over-written in the gateway's database with the Thing Description provided in the IPC message.

This means that every time the gateway starts up there are multiple database writes happening that don't need to happen.

I think thingAdded messages are only meant to be sent by adapters when the gateway starts the pairing process, so these messages shouldn't be sent at all on startup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant