Code

Opened 3 years ago

Closed 2 years ago

#16967 closed Bug (fixed)

CachedStaticFilesStorage only populates the file name cache once, never updates

Reported by: mkai Owned by: nobody
Component: contrib.staticfiles Version: master
Severity: Normal Keywords: CachedStaticFilesStorage, cache
Cc: jezdez Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I noticed that the cache that CachedStaticFilesStorage uses for performance reasons (i. e. to avoid having to recalculate the MD5 hash for a file's contents) is populated only once, during collectstatic. Therefore, if memcached goes down and needs to be restarted, it will need to recalculate the MD5 hash for every subsequent static file request, because the cache query will always miss.

I suggest that if a cache query misses, the corresponding file name in the cache should be updated/ rewritten.

Attachments (0)

Change History (3)

comment:1 Changed 2 years ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 2 years ago by jezdez

Sounds like a plan, indeed.

comment:3 Changed 2 years ago by jezdez

  • Resolution set to fixed
  • Status changed from new to closed

In [17067]:

Fixed #16967 -- Made sure CachedStaticFilesStorage repopulates its cache if there was a miss (for example if the cache server went down).

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.