Skip to content

Commit

Permalink
Merge pull request #1056 from ipfs-force-community/fix/0x5459/wdpost-…
Browse files Browse the repository at this point in the history
…worker-prover-not-allow-heartbeat-finished-tasks

fix: donot allow heartbeat to finished tasks
  • Loading branch information
LinZexiao committed Dec 13, 2023
2 parents d685e21 + 12b68a0 commit 28deb0e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@


- damocles-manager
- wdpost worker prover 模式,不允许向已完成的任务发送心跳 [#1056](https://github.com/ipfs-force-community/damocles/pull/1056)
- 支持配置多个 sender 地址,选择其中一个有效的且余额最多的地址作为发送地址 [#1045](https://github.com/ipfs-force-community/damocles/pull/1045)
- 修复对 core.SealerCliAPIClient 错误的依赖注入,导致 damocles-manager 代理模式无法正常启动 [#1047](https://github.com/ipfs-force-community/damocles/pull/1047)
- 修复配置多个 Name 为空的 PersistStores 时启动报错的 bug [#1046](https://github.com/ipfs-force-community/damocles/pull/1046)
Expand Down
6 changes: 5 additions & 1 deletion damocles-manager/modules/impl/prover/worker/job_mgr_kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,15 @@ func (tm *kvJobManager) Heartbeat(ctx context.Context, jobIDs []string, workerNa
kvstore.LoadJSON(&job),
kvstore.Key(makeWdPoStKey(core.WdPoStJobRunning, jobID)),
kvstore.Key(makeWdPoStKey(core.WdPoStJobReadyToRun, jobID)),
kvstore.Key(makeWdPoStKey(core.WdPoStJobFinished, jobID)),
)
if err != nil {
return err
}

if job.State != string(core.WdPoStJobRunning) {
log.Infof("heartbeat non-running task: %s, state: %s", job.ID, job.State)
}

if err := txn.Del(key); err != nil {
return err
}
Expand All @@ -220,6 +223,7 @@ func (tm *kvJobManager) Heartbeat(ctx context.Context, jobIDs []string, workerNa
if err := txn.PutJson(kvstore.Key(makeWdPoStKey(core.WdPoStJobRunning, jobID)), &job); err != nil {
return err
}

}
return nil
})
Expand Down

0 comments on commit 28deb0e

Please sign in to comment.