rclone misc#37
Open
omar-polo wants to merge 9 commits into
Open
Conversation
scanFolder does not use the path. It's ListFolder that request a specific path, scanFolder only consumes the reply.
it's a TOCTOU not needed. we already have in the stdlib CreateTemp() which deals with concurrency.
Otherwise we might leave records unprocessed on the channel. It'll be the responsability of the caller to close records on cancellation.
The functions run with Go() won't fail, and we don't need ctx.Done() to close on Wait().
Collaborator
Author
|
better read commit by commit, and in one case even with the white spaces disabled. all commits (should be?) are trivial, no functional changes intended. |
Collaborator
Author
|
extra note: I don't know why AutoremoveTmpFile in its Close() has the temp file removal commented. |
There was a problem hiding this comment.
Pull request overview
This PR makes a set of small cleanups across the rclone integration, primarily around RPC payload typing, importer temp-file handling, and exporter concurrency/control-flow.
Changes:
- Tighten rclone RPC payload types from
map[string]interface{}tomap[string]string. - Simplify importer scanning by removing unused path-component helpers and adjusting
scanFoldercall sites. - Refactor exporter
Exportloop/concurrency wiring.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| rclone/storage/storage.go | Uses a map[string]string payload for operations/list. |
| rclone/importer/importer.go | Removes debug-only artifacts, simplifies scanning, adjusts list/copy payload typing, and changes temp file creation logic for downloads. |
| rclone/exporter/exporter.go | Refactors Export to a simpler range loop with an errgroup.Group concurrency limit. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
128
to
+130
| func (p *RcloneImporter) scanRecursive(results chan<- *connectors.Record, path string, wg *sync.WaitGroup) { | ||
| response, _ := p.ListFolder(results, path) | ||
| p.scanFolder(results, path, response, wg) | ||
| p.scanFolder(results, response, wg) |
Comment on lines
133
to
137
| func (p *RcloneImporter) ListFolder(results chan<- *connectors.Record, path string) (Response, error) { | ||
| payload := map[string]interface{}{ | ||
| payload := map[string]string{ | ||
| "fs": fmt.Sprintf("%s:%s", p.Typee, p.Base), | ||
| "remote": path, | ||
| } |
Comment on lines
258
to
262
| return nil, fmt.Errorf("failed to copy file: %s", body) | ||
| } | ||
|
|
||
| tmpFile, err := os.Open(name) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| return &AutoremoveTmpFile{tmpFile}, nil | ||
| return &AutoremoveTmpFile{fp}, nil | ||
| } |
Comment on lines
+90
to
+94
| for record := range records { | ||
| if record.Err != nil { | ||
| results <- record.Ok() | ||
| continue | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.