Skip to content

Commit 5bc4be6

Browse files
committed
fix: ctld restarts without allocating licenses.
1 parent 00a1212 commit 5bc4be6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/CraneCtld/TaskScheduler.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ void TaskScheduler::PutRecoveredTaskIntoRunningQueueLock_(
518518
for (const CranedId& craned_id : task->CranedIds())
519519
g_meta_container->MallocResourceFromNode(craned_id, task->TaskId(),
520520
task->resources);
521-
521+
g_licenses_manager->MallocLicenseResource(task->licenses_count);
522522
// The order of LockGuards matters.
523523
LockGuard running_guard(&m_running_task_map_mtx_);
524524
LockGuard indexes_guard(&m_task_indexes_mtx_);
@@ -2659,13 +2659,14 @@ CraneErr TaskScheduler::AcquireTaskAttributes(TaskInCtld* task) {
26592659
for (auto&& node : nodes) task->excluded_nodes.emplace(std::move(node));
26602660
}
26612661

2662-
auto check_licenses_result = g_licenses_manager->CheckLicensesLegal(task->TaskToCtld().licenses_count());
2662+
auto check_licenses_result = g_licenses_manager->CheckLicensesLegal(
2663+
task->TaskToCtld().licenses_count());
26632664
if (check_licenses_result.has_error()) {
26642665
CRANE_ERROR("Failed to call CheckLicensesLegal: {}",
26652666
check_licenses_result.error());
26662667

26672668
return CraneErr::kInvalidParam;
2668-
}
2669+
}
26692670

26702671
return CraneErr::kOk;
26712672
}

0 commit comments

Comments
 (0)