Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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地址
1 change: 1 addition & 0 deletions internal/dao/file_dao.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion internal/downloader/remote_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion internal/router/http_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
1 change: 0 additions & 1 deletion internal/service/sys_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ var (
hasSentFailureMsg bool
)

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