save works

This commit is contained in:
Rongsong Shen 2026-03-04 18:18:53 +08:00
parent acfbec875b
commit 3f74f14687
38 changed files with 751 additions and 448 deletions

View file

@ -129,7 +129,7 @@ static int do_reply_workerlist(cluster_t* c, endpoint_t* ep,
}
unlock_collect_workers(&wlist);
xlist_fini(&wlist);
return rc;
@ -148,7 +148,7 @@ static int do_reply_joblist(cluster_t* c, endpoint_t* ep,
init_reply_by_req(&reply, request);
xlist_init(&jlist, 1024*1024);
xlist_init(&jlist, 1024 * 1024);
if (match->type == MatchCondition_condition_matchjid) {
job_t* j = NULL;
@ -156,10 +156,18 @@ static int do_reply_joblist(cluster_t* c, endpoint_t* ep,
jobdata.n_total = 0;
jobdata.jobs = NULL;
lock(c->jobmgr, RTTI_LOCK_READ);
rc = key_find(c->jobmgr, (void*)match->condition.jobid, (void**)&j);
if (j != NULL) {
reference(j);
}
unlock(c->jobmgr);
if (rc > 0) {
lock(j, RTTI_LOCK_WRITE);
lock(j, RTTI_LOCK_READ);
xlist_store(&jlist, &(j->job));
} else {
dereference(j);
}
} else {
collect_jobs(c, NULL, &jlist);
@ -174,9 +182,8 @@ static int do_reply_joblist(cluster_t* c, endpoint_t* ep,
rc = xce_reply_get(ep, c->myhost, &reply, check_controller, c, 100);
unlock_collect_jobs(&jlist);
FREEUP(jobdata.jobs);
return rc;