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

Improve Request Queue Behavior #6 #860

Merged
merged 7 commits into from
Jan 9, 2024

Conversation

slugzero
Copy link
Contributor

@slugzero slugzero commented Jan 8, 2024

This is the 6th and final PR in a series to implement Koenkk/zigbee2mqtt#17177.

It removes the special behavior for sendWhen=fastpoll devices (568abc3). I.e. the same queue behavior is now consistently used for all devices according to their pendingRequestTimeout and per-request sendPolicy.

The rest of the PR is cleanup: After the removal of the special behavior, sendWhen is not used anywhere any more and therefore I removed it from the request queue. To maintain backwards compatibility, I added conversion functions for the public interfaces. I also added tests for these functions and removed some other now-obsolete tests.

@@ -102,9 +101,19 @@ class Device extends Entity {
set skipDefaultResponse(skipDefaultResponse: boolean) {this._skipDefaultResponse = skipDefaultResponse;}
get skipTimeResponse(): boolean {return this._skipTimeResponse;}
set skipTimeResponse(skipTimeResponse: boolean) {this._skipTimeResponse = skipTimeResponse;}
get defaultSendRequestWhen(): SendRequestWhen {return this._defaultSendRequestWhen;}
set defaultSendRequestWhen(defaultSendRequestWhen: SendRequestWhen) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are only 3 references to this in zigbee-herdsman-converters, could we refactor those and remove this entirely?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be fine for me, too - I just thougt we could give it a little grace period, remove the 3 occcurrences (and maybe also all occurrences of sendWhen) and then remove the adapters.
Should I better remove it right away and prepare a PR for zhc?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do it right away, I will merge the PRs at the same time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, corresponding zhc PR is here: Koenkk/zigbee-herdsman-converters#6865

const request = new Request(func, frame, this.getDevice().pendingRequestTimeout, options.sendWhen,
options.sendPolicy);

if(options.sendWhen) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we also remove this part? (maybe in a next PR?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely! And yes, that will be another PR:-)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks for your dedication 😄

@Koenkk Koenkk merged commit 746fafb into Koenkk:master Jan 9, 2024
1 check passed
@Koenkk
Copy link
Owner

Koenkk commented Jan 9, 2024

Thanks! I think the option.sendWhen can also be removed (#860 (comment))

@slugzero slugzero deleted the request-queue-fixes-6 branch January 10, 2024 12:31
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.

2 participants