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

Backport Rack::Request cache helpers. #2056

Closed

Conversation

ioquatix
Copy link
Member

@ioquatix ioquatix commented Mar 15, 2023

I would characterise this as a bug fix, as without it, the cache is not computed correctly.

#2054

@ioquatix ioquatix changed the base branch from main to 3-0-stable March 15, 2023 03:44
* Per-class cache keys for cached query/body parameters.

* Use the query parser class as the default cache key.
Copy link
Contributor

@jeremyevans jeremyevans left a comment

Choose a reason for hiding this comment

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

I would consider this a new feature, not a bug fix, and would usually be against backporting. However, considering what has already been backported was much more invasive/disruptive, I guess there isn't much additional harm in backporting this. So I'm OK with the idea of backporting this. See inline comment regarding cache_key (which was changed after I approved the related PR), which I think should be fixed before backporting.

# behaviour. This includes sub-classes that override query_parser or
# expand_params.
def cache_key
query_parser.class
Copy link
Contributor

Choose a reason for hiding this comment

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

I still think this is a mistake, and think the onus should be on the framework to override this appropriately. If you have to base it on the query parser, query_parser would be better than query_parser.class, considering that the default is to use a singleton QueryParser instance (Utils.default_query_parser), and singleton classes allow for the changing of behavior for individual instances. It would be best to fix that first, and include that in the backport.

@ioquatix ioquatix mentioned this pull request Mar 15, 2023
@ioquatix
Copy link
Member Author

We decided to give up on this, and change the query parser behaviour back to 2.x where nil values can be exposed.

@ioquatix ioquatix closed this Mar 16, 2023
@ioquatix ioquatix deleted the 3-0-rack-request-cache-for branch March 16, 2023 01:41
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.

None yet

2 participants