Guard PostgreSQL action ledger optionals
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m52s
Foundation / checks (client) (push) Successful in 13m36s
Foundation / checks (network) (push) Successful in 14m54s
Foundation / checks (tsan) (push) Successful in 8m22s
Foundation / checks (postgres) (push) Failing after 23m23s
Foundation / checks (checks) (push) Successful in 37m42s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped

This commit is contained in:
dingo
2026-10-11 14:53:32 -04:00
parent 8a9a318d78
commit 2518282ff0
2 changed files with 11 additions and 4 deletions
@@ -47,7 +47,7 @@ PostgresActionLedger::find_record(const network::AccountId& account, std::uint64
}
if (!found.value())
return std::optional<network::DurableActionRecord>{};
const auto& row = *found.value();
const auto row = found->value_or(persistence::CommittedActionRecord{});
const auto result = static_cast<network::ActionResult>(row.result);
network::DurableActionRecord record{
network::ActionOutcome{action_id, result, row.action.tick, row.action.commit_sequence},
@@ -62,7 +62,7 @@ PostgresActionLedger::find_record(const network::AccountId& account, std::uint64
} else if (result != network::ActionResult::committed_no_effect) {
return std::unexpected(network::ActionLedgerError::unavailable);
}
return std::optional<network::DurableActionRecord>{std::move(record)};
return std::optional<network::DurableActionRecord>{record};
}
std::expected<std::vector<std::optional<network::DurableActionRecord>>, network::ActionLedgerError>
@@ -93,7 +93,7 @@ PostgresActionLedger::find_all_records(std::span<const network::ActionKey> keys)
for (std::size_t i = 0; i < keys.size(); ++i) {
if (!(*found)[i])
continue;
const auto& row = *(*found)[i];
const auto row = (*found)[i].value_or(persistence::CommittedActionRecord{});
const auto result = static_cast<network::ActionResult>(row.result);
network::DurableActionRecord record{network::ActionOutcome{keys[i].action_id, result,
row.action.tick,
@@ -110,7 +110,7 @@ PostgresActionLedger::find_all_records(std::span<const network::ActionKey> keys)
} else if (result != network::ActionResult::committed_no_effect) {
return std::unexpected(network::ActionLedgerError::unavailable);
}
out[i] = std::move(record);
out[i] = record;
}
return out;
}