Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.

Improve FileSystemStorage handling #139

Closed
ghost opened this issue Jul 7, 2019 · 2 comments
Closed

Improve FileSystemStorage handling #139

ghost opened this issue Jul 7, 2019 · 2 comments

Comments

@ghost
Copy link

ghost commented Jul 7, 2019

(I'll gladly make a PR, just let me know which solution you prefer).

When we are using a standard file system storage, no e-tags are created and so files are always "stale". There's two things we can do here:

  1. Use call_command to invoke Django's collectstatic
  2. Implement an e-tag based upon the md5 hash of absolute path and last modified timestamp.

Right now, all files are always copied, which is worse then the original command.

@antonagestam
Copy link
Owner

Hi there,

See my comment here: #137 (comment)

Do you think this case also could be covered by a HashStrategy? Maybe the abstraction need to be one level higher, something like ShouldCopyStrategy? (terrible name, sorry)

As for 1. vs 2., I don't have strong opinions. If we introduce the concept of pluggable strategies, maybe it can be made configurable? I guess both wouldn't have to be implemented initially, you could start with the strategy that will work best for you.

@antonagestam
Copy link
Owner

Support for pluggable strategies have now been merged. Implementing a strategy optimized for FileSystemStorage should now be a lot easier. See the abstract base classes in https://github.com/antonagestam/collectfast/blob/master/collectfast/strategies/base.py#L34, as well as the boto, boto3, and gloud implementations in the surrounding modules :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant