|
|
@@ -69,8 +69,11 @@ RunnerCapabilities RunnerCapabilities::fromJson(const nlohmann::json& j) {
|
|
|
|
|
|
// Runner
|
|
|
nlohmann::json Runner::toJson() const {
|
|
|
- // Note: id is managed by database as _id
|
|
|
+ // _id mirrors the storage document key, matching fromJson() and the shape
|
|
|
+ // every other endpoint returns. persistRunner() strips it before writing,
|
|
|
+ // since there the id is the key rather than part of the body.
|
|
|
return {
|
|
|
+ {"_id", id},
|
|
|
{"address", address},
|
|
|
{"status", runnerStatusToString(status)},
|
|
|
{"registeredAt", registered_at},
|
|
|
@@ -307,7 +310,9 @@ void RunnerRegistry::checkRunnerTimeouts() {
|
|
|
}
|
|
|
|
|
|
void RunnerRegistry::persistRunner(const Runner& runner) {
|
|
|
- storage_.update("runners", runner.id, runner.toJson(), 0, false);
|
|
|
+ nlohmann::json doc = runner.toJson();
|
|
|
+ doc.erase("_id"); // the id is the document key, not a body field
|
|
|
+ storage_.update("runners", runner.id, doc, 0, false);
|
|
|
}
|
|
|
|
|
|
void RunnerRegistry::removeRunner(const std::string& runner_id) {
|