mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-26 17:49:15 +01:00
fix(spider): update node selection to use active nodes instead of all nodes
fix(spider): optimize form update logic to watch specific fields for changes fix(grpc): adjust sync request ID handling for git and regular spiders
This commit is contained in:
@@ -33,9 +33,19 @@ func (r *Runner) syncFilesGRPC() (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
// Determine the ID to use for sync request
|
||||
// For git spiders, use GitId (where files are stored)
|
||||
// For regular spiders, use SpiderId
|
||||
var syncId string
|
||||
if r.s.GitId.IsZero() {
|
||||
syncId = r.s.Id.Hex()
|
||||
} else {
|
||||
syncId = r.s.GitId.Hex()
|
||||
}
|
||||
|
||||
// Prepare request
|
||||
req := &grpc2.FileSyncRequest{
|
||||
SpiderId: r.s.Id.Hex(),
|
||||
SpiderId: syncId,
|
||||
Path: workingDir,
|
||||
NodeKey: utils.GetNodeKey(),
|
||||
}
|
||||
@@ -149,7 +159,13 @@ func (r *Runner) syncFilesGRPC() (err error) {
|
||||
}
|
||||
|
||||
if needsDownload {
|
||||
if err := r.downloadFileGRPC(syncClient, r.s.Id.Hex(), path); err != nil {
|
||||
// For git spiders with sub-folders, prepend GitRootPath to the download path
|
||||
// because the server stores files at workspace/{git_id}/{git_root_path}/...
|
||||
downloadPath := path
|
||||
if workingDir != "" {
|
||||
downloadPath = filepath.Join(workingDir, path)
|
||||
}
|
||||
if err := r.downloadFileGRPC(syncClient, syncId, downloadPath); err != nil {
|
||||
r.Errorf("error downloading file %s: %v", path, err)
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user