Skip to content

Commit 49dfd86

Browse files
zhaoxianhuagithubgxll
authored andcommitted
[fix][dingospeed] Fixed upload progress of file integer block
1 parent 3ac4a46 commit 49dfd86

File tree

5 files changed

+9
-5
lines changed

5 files changed

+9
-5
lines changed

config/config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ diskClean:
6666
collectTimePeriod: 1 #定期检测磁盘使用量时间周期,单位小时(H)
6767

6868
dynamicProxy:
69-
enabled: false
69+
enabled: true
7070
httpProxy: http://127.0.0.1:7890
7171
httpProxyName: "马鞍山服务器"
72-
timePeriod: 1 #定期检测代理是否可用时间周期,单位秒(S)
72+
timePeriod: 60 #定期检测代理是否可用时间周期,单位秒(S)
7373
maxContinuousFails: 5 #连续失败次数超过该值,则认为代理不可用
7474
webhook: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=73662ac1-1055-48a7-8c89-37964b5f4fdc111 # 企业微信机器人Webhook地址

internal/dao/file_dao.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ func (f *FileDao) GetFileCommitSha(c echo.Context, repoType, orgRepo, commit str
8585
code, sha, err := f.getCommitHfRemote(repoType, orgRepo, commit, authorization)
8686
if err == nil {
8787
if code != http.StatusOK && code != http.StatusTemporaryRedirect {
88+
zap.S().Errorf(" getFileCommitSha getCommitHfRemote code:%d", code)
8889
return "", myerr.NewAppendCode(code, "code is invalid.")
8990
} else {
9091
commitSha = sha

internal/downloader/remote_task.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,10 @@ func (r *RemoteFileTask) DoTask() {
163163
}
164164
lastBlock = curBlock
165165
}
166-
if int64(len(rawBlock)) == r.DingFile.GetBlockSize() {
166+
// 一个空文件,或文件刚好为blocksize的整数倍,直接标记为完成
167+
if len(rawBlock) == 0 {
168+
data.ReportFileProcess(r.Context, lastReportPos, curPos, consts.StatusDownloaded)
169+
} else if int64(len(rawBlock)) == r.DingFile.GetBlockSize() {
167170
hasBlockBool, err := r.DingFile.HasBlock(lastBlock)
168171
if err != nil {
169172
zap.S().Errorf("HasBlock err.%v", err)

internal/router/http_router.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,6 @@ func (r *HttpRouter) initRouter() {
6969
r.echo.GET("/repos", r.metaHandler.ReposHandler)
7070
r.echo.Any("/*", r.metaHandler.ForwardToNewSiteHandler)
7171

72-
r.echo.GET("/api/:dataType/:org/:repo/:etag/:fileSize", r.fileHandler.GetFileOffset)
72+
// 内部使用
73+
r.echo.GET("/api/fileOffset/:dataType/:org/:repo/:etag/:fileSize", r.fileHandler.GetFileOffset)
7374
}

internal/service/sys_service.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ var (
225225
hasSentFailureMsg bool
226226
)
227227

228-
// testProxyConnectivity 测试代理服务器的连接连通性
229228
func testProxyConnectivity() {
230229
proxyURL, err := url.Parse(config.SysConfig.GetHttpProxy())
231230
if err != nil {

0 commit comments

Comments
 (0)