Skip to content

feat: add chunk size in .env#54

Merged
RambokDev merged 1 commit intomainfrom
feat/tus-chunk-size
Apr 16, 2026
Merged

feat: add chunk size in .env#54
RambokDev merged 1 commit intomainfrom
feat/tus-chunk-size

Conversation

@RambokDev
Copy link
Copy Markdown
Contributor

@RambokDev RambokDev commented Apr 16, 2026

Summary by CodeRabbit

  • New Features

    • Configurable upload chunk size via CHUNK_SIZE_MB environment variable (1–10 MB range, default 1 MB).
  • Chores

    • Updated service environment configuration.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 16, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 17a56b9a-9cbb-4d11-9958-378c9e4a8e19

📥 Commits

Reviewing files that changed from the base of the PR and between 86027fd and f3a49ef.

📒 Files selected for processing (4)
  • docker-compose.yml
  • src/settings.rs
  • src/utils/stream.rs
  • src/utils/tus.rs

📝 Walkthrough

Walkthrough

Introduces configurable chunk size management across the application. A new chunk_size setting is added to the configuration layer (parsed from CHUNK_SIZE_MB environment variable with 1-10 MiB validation), then used to replace fixed buffer sizes in stream handling and TUS protocol implementations.

Changes

Cohort / File(s) Summary
Configuration Management
docker-compose.yml, src/settings.rs
Added CHUNK_SIZE_MB environment variable (default 1 MiB, range 1-10) to docker-compose.yml. Extended Settings struct with new chunk_size field (computed in bytes) and implemented environment-based parsing with range validation.
Stream Handling
src/utils/stream.rs
Replaced tokio_util::io::ReaderStream with manual async_stream::stream! implementation that allocates buffers sized to CONFIG.chunk_size and yields chunks asynchronously. Simplified error handling by returning raw tokio read errors.
TUS Protocol Integration
src/utils/tus.rs
Removed fixed PATCH_CHUNK_SIZE constant and replaced with configurable CONFIG.chunk_size for determining sub-chunk sizes during TUS PATCH operations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Chunks of data, now so small,
Config whispers to them all,
From one to ten, we dance with glee,
Streams and patches, wild and free!
Configurable dreams come true, hooray! 🎉

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/tus-chunk-size

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@RambokDev RambokDev merged commit 14a6c9a into main Apr 16, 2026
1 of 2 checks passed
@RambokDev RambokDev deleted the feat/tus-chunk-size branch April 16, 2026 09:20
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 16, 2026

Codecov Report

❌ Patch coverage is 81.25000% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/utils/tus.rs 0.00% 2 Missing ⚠️
src/settings.rs 88.88% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant