Chunks: use a prefix of the chunk for a subdirectory.

Filesystems don't handle massive directories too well, so better to split.
Using the prefix of the chunk gives us a maximum of 64 * 64 = 4096 entries
in the main directory.
master
Tom Hacohen 4 years ago
parent 393b85d3ca
commit e385aa8f20

@ -87,7 +87,9 @@ def chunk_directory_path(instance, filename):
col = instance.collection col = instance.collection
user_id = col.owner.id user_id = col.owner.id
return Path('user_{}'.format(user_id), col.uid, instance.uid) uid_prefix = instance.uid[:2]
uid_rest = instance.uid[2:]
return Path('user_{}'.format(user_id), col.uid, uid_prefix, uid_rest)
class CollectionItemChunk(models.Model): class CollectionItemChunk(models.Model):

Loading…
Cancel
Save