Improve code in BufferingProxyStorage
swh/storage/buffer.py
could use some improvements:
- Renaming
s
tostats
would be clearer to me. It'd be nice to do the renaming throughout, at some point. You could also add a comment saying thatif not stats:
means thatobject_add
didn't flush the buffers, and we should check for the volume of contents. -
queue
,content
instead ofq
,c
- we should store and update the sum of content lengths in an attribute on the fly to avoid a gratuitous quatratic behavior.
- At some point we should rename
min_batch_size
tobuffer_thresholds
or something clearer.
Migrated from T2287 (view on Phabricator)