Skip to content

Commit

Permalink
Add min_size
Browse files Browse the repository at this point in the history
  • Loading branch information
squeaky-pl committed Nov 6, 2024
1 parent 2cdcaf0 commit 01f9b55
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bin/recompress-raw-mime.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def find_messages(
namespace_id: "int | None",
batch_size: int,
max_size: "int | None",
min_size: "int | None",
) -> "Iterable[tuple[Message, int]]":
query = Query([Message]).order_by(Message.id)

Expand All @@ -112,6 +113,8 @@ def find_messages(
query = query.filter(Message.namespace_id == namespace_id)
if max_size:
query = query.filter(Message.size <= max_size)
if min_size:
query = query.filter(Message.size > min_size)

inner_max_id_query = query.with_entities(Message.id)
if limit is not None:
Expand Down Expand Up @@ -268,6 +271,7 @@ def recompress_batch(
@click.option("--check-existence/--no-check-existence", default=False)
@click.option("--compression-level", type=int, default=3)
@click.option("--max-size", type=int, default=None)
@click.option("--min-size", type=int, default=None)
@click.option(
"--max-recompress-batch-bytes", type=int, default=MAX_RECOMPRESS_BATCH_BYTES
)
Expand All @@ -287,6 +291,7 @@ def run(
check_existence: bool,
compression_level: int,
max_size: "int | None",
min_size: "int | None",
max_recompress_batch_bytes: int,
fraction: "str | None",
) -> int:
Expand Down Expand Up @@ -326,6 +331,7 @@ def shutdown(signum, frame):
namespace_id,
batch_size,
max_size,
min_size,
)

recompress_sha256s: dict[str, int] = {}
Expand Down

0 comments on commit 01f9b55

Please sign in to comment.