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
10 changes: 6 additions & 4 deletions internal/dao/repository_dao.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,9 @@ func (r *RepositoryDao) DeleteByInstanceIdAndDatatypeAndOrgAndRepo(instanceId st

func (r *RepositoryDao) UpdateRepositoryMountStatus(statusReq *query.UpdateMountStatusReq) error {
var (
msgStr []byte
err error
msgStr []byte
err error
newMsgStr string
)
if statusReq.ErrorMsg != "" {
msg := make(map[string]string, 0)
Expand All @@ -344,10 +345,11 @@ func (r *RepositoryDao) UpdateRepositoryMountStatus(statusReq *query.UpdateMount
if err != nil {
return err
}
newMsgStr = strings.ReplaceAll(string(msgStr), "'", "''")
}
sql := fmt.Sprintf("UPDATE repository SET status = %d, error_msg = '%s', updated_at = '%s' WHERE id = %d",
statusReq.Status, string(msgStr), util.GetCurrentTimeStr(), statusReq.Id)
if err := r.baseData.BizDB.Exec(sql).Error; err != nil {
statusReq.Status, newMsgStr, util.GetCurrentTimeStr(), statusReq.Id)
if err = r.baseData.BizDB.Exec(sql).Error; err != nil {
return err
}
return nil
Expand Down
4 changes: 2 additions & 2 deletions internal/router/http_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (r *HttpRouter) repositoryRouter() {
r.echo.GET("/api/v1/repository/card/:aidcCode/:id", r.repositoryHandler.RepositoryCardHandler) // 仓库介绍
r.echo.GET("/api/v1/repository/files/:aidcCode/:id/", r.repositoryHandler.RepositoryFilesHandler) // 仓库文件目录
r.echo.GET("/api/v1/repository/files/:aidcCode/:id/:filePath", r.repositoryHandler.RepositoryFilesHandler) // 仓库文件目录
r.echo.POST("/api/v1/repositories/mount", r.repositoryHandler.MountRepositoryHandler) // 挂载缓存
r.echo.POST("/api/v1/repositories/mount", r.repositoryHandler.MountRepositoryHandler) // 挂载缓存(公共目录)

r.echo.GET("/api/v1/tags", r.tagHandler.TagHandler)
r.echo.GET("/api/v1/task_tags", r.tagHandler.TaskTagHandler)
Expand All @@ -76,7 +76,7 @@ func (r *HttpRouter) repositoryRouter() {

func (r *HttpRouter) cacheJobRouter() {
r.echo.GET("/api/v1/cacheJob/list", r.cacheJobHandler.ListCacheJobHandler)
r.echo.POST("/api/v1/cacheJob/create", r.cacheJobHandler.CreateCacheJobHandler)
r.echo.POST("/api/v1/cacheJob/create", r.cacheJobHandler.CreateCacheJobHandler) // 缓存任务创建
r.echo.POST("/api/v1/cacheJob/stop", r.cacheJobHandler.StopCacheJobHandler)
r.echo.POST("/api/v1/cacheJob/resume", r.cacheJobHandler.ResumeCacheJobHandler)
r.echo.DELETE("/api/v1/cacheJob/:id", r.cacheJobHandler.DeleteCacheJobHandler)
Expand Down
7 changes: 4 additions & 3 deletions internal/service/repository_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func (s *RepositoryService) MountRepository(repoReq *query.RepositoryReq) error
if repository.Status == consts.StatusCacheJobIng || repository.Status == consts.StatusCacheJobComplete {
return myerr.New("当前状态不可执行该操作。")
}
entity, err := s.dingospeedDao.GetEntity(repository.InstanceId, true)
entity, err := s.dingospeedDao.GetEntity(repository.InstanceId, false) // 挂载到公共目录,通过离线模式处理
if err != nil {
return err
}
Expand All @@ -249,8 +249,9 @@ func (s *RepositoryService) MountRepository(repoReq *query.RepositoryReq) error
RepositoryId: repository.ID,
Type: consts.CacheTypeMount,
InstanceId: repository.InstanceId,
Org: repository.Org, Repo: repository.Repo,
Datatype: repository.Datatype,
Org: repository.Org,
Repo: repository.Repo,
Datatype: repository.Datatype,
}
b, err := sonic.Marshal(createCacheJobReq)
if err != nil {
Expand Down