gclone icon indicating copy to clipboard operation
gclone copied to clipboard

只在750g上传达到时才切换sa

Open Rhilip opened this issue 2 years ago • 5 comments

目前在遇到 ratelimit 的时候就会自动切换sa,但其实ratelimit并不一定达到 750G上传的限制,也有可能是请求过快。 此时再切换sa,反而会因为频繁切换sa被google封project。

https://github.com/dogbutcat/gclone/blob/7f0d26f130d6ce795fd2282498008b02b81f52f9/backend/drive/drive.go#L756-L766

希望能和rclone参照的StopOnUploadLimit功能相结合,增加 rollingOnUploadLimit 选项

// 我不会Go语言,所以以下仅作示例
if (!f.opt.rollingOnUploadLimit && f.opt.ServiceAccountFilePath != "")  {
    f.waitChangeSvc.Lock()
	f.changeSvc(ctx)
	f.waitChangeSvc.Unlock()
	return true, err
}
if gerr.Errors[0].Message == "User rate limit exceeded." {
	if (f.opt.rollingOnUploadLimit && f.opt.ServiceAccountFilePath != "") {
    	f.waitChangeSvc.Lock()
    	f.changeSvc(ctx)
    	f.waitChangeSvc.Unlock()
    	return true, err
	}
    if (f.opt.StopOnUploadLimit) {	
    	fs.Errorf(f, "Received upload limit error: %v", err)
    	return false, fserrors.FatalError(err)
	}
}

Rhilip avatar Jun 29 '22 02:06 Rhilip

请问楼主,封project是整个sa都封掉了吗

jidanyunmian avatar Jul 01 '22 16:07 jidanyunmian

请问楼主,封project是整个sa都封掉了吗

被封的project下所有sa无法使用,可以删了被封的project重来。

Rhilip avatar Jul 02 '22 01:07 Rhilip

感谢回复,现在团队盘 to 团队盘 不走服务器的话 gclone每天只有2T的配额了?

jidanyunmian avatar Jul 02 '22 06:07 jidanyunmian

谢谢您的建议。

对于您的建议我想问下您是在什么情况下会遇到过请求过快?

官方文档对于错误的描述如下

A rateLimitExceeded error indicates the project's rate limit has been reached. This limit varies depending on the type of requests. Following is the JSON representation of this error

A userRateLimitExceeded error indicates the per-user limit has been reached. This might be a limit from the Google API Console or a limit from the Drive backend. Following is the JSON representation of this error

这两种场景都是需要切换的。

我猜想您如果指的是api请求之间不要太过于频繁, 那么rclone提供了相应的api用于适当延长时间:

--drive-pacer-min-sleep
Minimum time to sleep between API calls.

Properties:

Config: pacer_min_sleep
Env Var: RCLONE_DRIVE_PACER_MIN_SLEEP
Type: Duration
Default: 100ms

dogbutcat avatar Jul 13 '22 09:07 dogbutcat

对于750G的upload limit.

我在备份3T的共享盘的过程中发现某个文件的owner上传到达limit之后 即使使用没有满额的sa读取对应owner的文件也会出现速率报错 也可能就是您描述的这种. 所以才加了rolling的功能. 所以我判断这个750G的limit是针对的本地上传. 远程备份可能与读写存在一定关联.

dogbutcat avatar Jul 13 '22 09:07 dogbutcat