diff --git a/config/config.yaml b/config/config.yaml index 0e614fe..9dc6cbd 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -66,9 +66,9 @@ diskClean: collectTimePeriod: 1 #定期检测磁盘使用量时间周期,单位小时(H) dynamicProxy: - enabled: false + enabled: true httpProxy: http://127.0.0.1:7890 httpProxyName: "马鞍山服务器" - timePeriod: 1 #定期检测代理是否可用时间周期,单位秒(S) + timePeriod: 60 #定期检测代理是否可用时间周期,单位秒(S) maxContinuousFails: 5 #连续失败次数超过该值,则认为代理不可用 webhook: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=73662ac1-1055-48a7-8c89-37964b5f4fdc111 # 企业微信机器人Webhook地址 diff --git a/internal/dao/file_dao.go b/internal/dao/file_dao.go index c77d929..8c19534 100644 --- a/internal/dao/file_dao.go +++ b/internal/dao/file_dao.go @@ -85,6 +85,7 @@ func (f *FileDao) GetFileCommitSha(c echo.Context, repoType, orgRepo, commit str code, sha, err := f.getCommitHfRemote(repoType, orgRepo, commit, authorization) if err == nil { if code != http.StatusOK && code != http.StatusTemporaryRedirect { + zap.S().Errorf(" getFileCommitSha getCommitHfRemote code:%d", code) return "", myerr.NewAppendCode(code, "code is invalid.") } else { commitSha = sha diff --git a/internal/downloader/remote_task.go b/internal/downloader/remote_task.go index 61e8ed2..e0a5e1c 100644 --- a/internal/downloader/remote_task.go +++ b/internal/downloader/remote_task.go @@ -163,7 +163,10 @@ func (r *RemoteFileTask) DoTask() { } lastBlock = curBlock } - if int64(len(rawBlock)) == r.DingFile.GetBlockSize() { + // 一个空文件,或文件刚好为blocksize的整数倍,直接标记为完成 + if len(rawBlock) == 0 { + data.ReportFileProcess(r.Context, lastReportPos, curPos, consts.StatusDownloaded) + } else if int64(len(rawBlock)) == r.DingFile.GetBlockSize() { hasBlockBool, err := r.DingFile.HasBlock(lastBlock) if err != nil { zap.S().Errorf("HasBlock err.%v", err) diff --git a/internal/router/http_router.go b/internal/router/http_router.go index 93a4f6e..50e40cb 100644 --- a/internal/router/http_router.go +++ b/internal/router/http_router.go @@ -69,5 +69,6 @@ func (r *HttpRouter) initRouter() { r.echo.GET("/repos", r.metaHandler.ReposHandler) r.echo.Any("/*", r.metaHandler.ForwardToNewSiteHandler) - r.echo.GET("/api/:dataType/:org/:repo/:etag/:fileSize", r.fileHandler.GetFileOffset) + // 内部使用 + r.echo.GET("/api/fileOffset/:dataType/:org/:repo/:etag/:fileSize", r.fileHandler.GetFileOffset) } diff --git a/internal/service/sys_service.go b/internal/service/sys_service.go index ec61114..bde5198 100644 --- a/internal/service/sys_service.go +++ b/internal/service/sys_service.go @@ -225,7 +225,6 @@ var ( hasSentFailureMsg bool ) -// testProxyConnectivity 测试代理服务器的连接连通性 func testProxyConnectivity() { proxyURL, err := url.Parse(config.SysConfig.GetHttpProxy()) if err != nil {