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

Fixed must match constraints check #275

Merged
merged 1 commit into from
May 18, 2022
Merged

Conversation

ivan-tymoshenko
Copy link
Collaborator

The is a bug with constraints with the mustMatchWhenDerived option.

How it should work. If you have a constraint with the mustMatchWhenDerived option in your request you can match only the routes that have and match this constraint.

How it works. If you have a constraint with the mustMatchWhenDerived option in your request you can match the routes that have and match this constraint or other routes that have any other different constraints.

There are some tests that test wrong behavior:

t.equal(findMyWay.find('GET', '/', { host: 'fastify.io', version: '2.0.0' }).handler, alpha)

t.equal(findMyWay.find('GET', '/', { host: 'fastify.io', version: '2.0.0' }).handler, alpha)

t.equal(findMyWay.find('GET', '/', { host: 'fastify.io', version: '2.0.0' }).handler, alpha)

Benchmarks:

Снимок экрана 2022-05-08 в 16 31 43

@mcollina
Copy link
Collaborator

mcollina commented May 8, 2022

could you fix the performance regression?

@ivan-tymoshenko
Copy link
Collaborator Author

The long static route doesn't have any regression as well as wildcard node doesn't have any speed up. It's a measuring error. The unconstraint route has performance regression. I had to remove some optimizations that I made in the previous PR. #273. I can't do anything with it.

Copy link
Collaborator

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@ivan-tymoshenko
Copy link
Collaborator Author

@mcollina Can we merge this PR?

Copy link
Collaborator

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@mcollina mcollina merged commit 541324c into main May 18, 2022
@ivan-tymoshenko ivan-tymoshenko deleted the fix-must-match-constraints-check branch May 18, 2022 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants