Enable direct streaming for SFTP uploads#31
Conversation
This change ensures that SFTP uploads are streamed directly to Discord instead of being fully buffered in memory when the file size is unknown. Key changes: - Supported unknown file sizes (sentinel -1) in `DCMsgFileContentRepository.save` and `FileMessageFromStream.read`. - Updated SFTP handler to always use `DCFSSFTPStreamingFile` for writes, enabling part-by-part streaming to Discord. - Ensured `FileUploader` correctly partitions streams with unknown sizes. - This applies natural backpressure via the async queue, matching the user's actual internet upload speed. Co-authored-by: VulcanoSoftware <113239901+VulcanoSoftware@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
SFTP uploads were occurring at unrealistically high speeds because they were being fully buffered in memory before being uploaded to Discord. This happened specifically when the SFTP client did not provide an expected file size during the
opencall.I have updated the DCFS core and the SFTP handler to support streaming uploads with unknown file sizes. Now, all SFTP writes use the
DCFSSFTPStreamingFilemechanism, which pipes data through anasyncio.Queueinto theDCMsgFileContentRepository. The repository now correctly handles streams without a pre-defined partition by reading and uploading parts until the stream is exhausted.This ensures that the SFTP client experiences backpressure from the actual Discord upload process, aligning the perceived speed with the user's internet bandwidth and avoiding excessive memory usage.
PR created automatically by Jules for task 2040905799993440024 started by @VulcanoSoftware