Skip to content

Commit

Permalink
Merge pull request #334 from tbs60/dev_tming
Browse files Browse the repository at this point in the history
feat:opt resource manager, issue: #332
  • Loading branch information
tming authored Dec 19, 2024
2 parents cee357e + 1c96ff8 commit a5a2fed
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/backend/booster/server/pkg/resource/crm/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ func (rm *resourceManager) launch(
}

// 在启动协程前,将resource刷新到内存,其它协程依赖该数据
r.status = resourceStatusDeploying
// r.status = resourceStatusDeploying
rm.updateResourcesCache(r)

// 将涉及到外部接口(资源分配和写数据库操作)单独起协程执行,避免阻塞pick流程
Expand Down Expand Up @@ -955,7 +955,10 @@ func (rm *resourceManager) realLaunch(
// TODO : 这个地方可能会导致资源泄漏(远程资源创建了,但是记录db失败,如果这时server重启,则没办法跟踪和释放);
// 概率比较小,先不处理
r.status = resourceStatusDeploying
if err = rm.saveResources(r); err != nil {
rm.lockResource(resourceID)
err = rm.saveResources(r)
rm.unlockResource(resourceID)
if err != nil {
blog.Errorf("crm: try launching service, save resource(%s) for user(%s) failed: %v",
resourceID, user, err)

Expand Down

0 comments on commit a5a2fed

Please sign in to comment.