lostisland / lostisland/faraday_middleware

Server Rack::Cache + Faraday Rack::Cache, cache doesn't expire

Open
#34 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
558
Forks
196
PR merge metrics
No merged PRs in 30d

Description

Now that I have server rack-cache and faraday rack-cache working together, I've found another issue: nothing expires from the cache. I'm having trouble narrowing in on the exact error - but it seems related to the faraday :net_http adapter. First I was getting a NoMethodError due to nil values in env[:request_headers], then, with a fix for that in rack_compatible, I get caching that refuses to expire.

Test case:

https://github.com/therabidbanana/faraday_middleware/commit/621d92972216988924162dac7b0c278b508d3701

Changing to :em_http has allowed me to work around the problem, but I can't hunt down the exact reason why.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the test case in commit 621d92972216988924162dac7b0c278b508d3701 and compare the :net_http and :em_http adapter paths when used with Server Rack::Cache and Faraday Rack::Cache. Trace the request headers and cache-expiration behavior, then confirm that cached responses expire with :net_http without the nil-header failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.