mirror of
https://github.com/rclone/rclone.git
synced 2025-06-24 22:11:45 +02:00
drive: when listing team drives, continue on failure
This means that if the team drive listing returns a 500 error (which seems reasonably common) rclone will continue to the point where it asks for the team drive ID. https://forum.rclone.org/t/many-team-drives-causes-rclone-to-fail/7159
This commit is contained in:
parent
e1503add41
commit
8ad7da066c
@ -715,6 +715,7 @@ func configTeamDrive(opt *Options, m configmap.Mapper, name string) error {
|
|||||||
fmt.Printf("Fetching team drive list...\n")
|
fmt.Printf("Fetching team drive list...\n")
|
||||||
var driveIDs, driveNames []string
|
var driveIDs, driveNames []string
|
||||||
listTeamDrives := svc.Teamdrives.List().PageSize(100)
|
listTeamDrives := svc.Teamdrives.List().PageSize(100)
|
||||||
|
listFailed := false
|
||||||
for {
|
for {
|
||||||
var teamDrives *drive.TeamDriveList
|
var teamDrives *drive.TeamDriveList
|
||||||
err = newPacer().Call(func() (bool, error) {
|
err = newPacer().Call(func() (bool, error) {
|
||||||
@ -722,7 +723,9 @@ func configTeamDrive(opt *Options, m configmap.Mapper, name string) error {
|
|||||||
return shouldRetry(err)
|
return shouldRetry(err)
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "list team drives failed")
|
fmt.Printf("Listing team drives failed: %v\n", err)
|
||||||
|
listFailed = true
|
||||||
|
break
|
||||||
}
|
}
|
||||||
for _, drive := range teamDrives.TeamDrives {
|
for _, drive := range teamDrives.TeamDrives {
|
||||||
driveIDs = append(driveIDs, drive.Id)
|
driveIDs = append(driveIDs, drive.Id)
|
||||||
@ -734,7 +737,7 @@ func configTeamDrive(opt *Options, m configmap.Mapper, name string) error {
|
|||||||
listTeamDrives.PageToken(teamDrives.NextPageToken)
|
listTeamDrives.PageToken(teamDrives.NextPageToken)
|
||||||
}
|
}
|
||||||
var driveID string
|
var driveID string
|
||||||
if len(driveIDs) == 0 {
|
if !listFailed && len(driveIDs) == 0 {
|
||||||
fmt.Printf("No team drives found in your account")
|
fmt.Printf("No team drives found in your account")
|
||||||
} else {
|
} else {
|
||||||
driveID = config.Choose("Enter a Team Drive ID", driveIDs, driveNames, true)
|
driveID = config.Choose("Enter a Team Drive ID", driveIDs, driveNames, true)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user