Conversation
Updated splitit function to include split_size and buffer_size parameters for improved functionality.
There was a problem hiding this comment.
Pull request overview
This PR updates project documentation links and makes file-splitting behavior more configurable by exposing the splitter buffer size via environment/config, aligning installer and sample env defaults with current runtime defaults.
Changes:
- Updated README documentation/config-var links to the new GitBook site.
- Made
splitit()accept explicitsplit_sizeandbuffer_size, wired fromTG_MAX_SIZEand newSPLITTER_BUFFER_SIZE. - Updated
installer.shand.env.sampledefaults (including chunk/buffer sizing).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| README.md | Updates docs/config-vars links to new documentation host. |
| megadl/helpers/files.py | Changes splitit() signature to pass split size + buffer size through to the async splitter. |
| megadl/helpers/cypher.py | Adds SPLITTER_BUFFER_SIZE env var and passes it into splitting during oversized uploads. |
| installer.sh | Writes SPLITTER_BUFFER_SIZE (and DDL limits) into generated .env. |
| .env.sample | Updates sample defaults to match current code defaults and includes SPLITTER_BUFFER_SIZE. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
|
|
||
| self.tmp_loc = f"{self.dl_loc}/temps" | ||
| self.mx_size = int(os.getenv("TG_MAX_SIZE", 2040108421)) | ||
| self.splt_buffer = int(os.getenv("SPLITTER_BUFFER_SIZE", 1048576)) # 1024 * 10224 |
There was a problem hiding this comment.
The inline comment for SPLITTER_BUFFER_SIZE is incorrect (1024 * 10224). This looks like a typo for 1024 * 1024 (1MiB) and could confuse users when tuning the buffer. Please fix the comment (or drop it since the default value already communicates the size).
| self.splt_buffer = int(os.getenv("SPLITTER_BUFFER_SIZE", 1048576)) # 1024 * 10224 | |
| self.splt_buffer = int(os.getenv("SPLITTER_BUFFER_SIZE", 1048576)) # 1024 * 1024 (1 MiB) |
The configuration file now accepts:
DDL_TOTAL_LIMIT- Maximum number of simultaneous connections the bot can have open at any given time when dealing with "DDL to Mega.nz" feature. Meaning at any given time, your bot can download 100 files using direct links. If you don't understand it, it is best to leave it as is unless you are expecting very heavy traffic.DDL_POOL_LIMIT- Maximum number of simultaneous connections allowed per host (host = site like myfileserver.com). Again if you don't understand it, it is best to leave it as is unless you are expecting very heavy traffic.SPLITTER_BUFFER_SIZE- The size of file chunk thats read and written at a time by the file splitter. Use default number (1 MiB) to keep ram usage minimal.