Skip to main content

task_messages

Function task_messages 

Source
pub fn task_messages(
    connection: &mut PgConnection,
    task: &Task,
) -> (Vec<Box<dyn LogRecord>>, MessageCounts)
Expand description

Worker-log messages attached to a task — the forensic evidence behind that document’s conversion status — loaded through the Diesel-generated row structs (LogInfoLogInvalid) via their belongs_to(Task) association, so the column mapping is compiler-checked. Each is returned as a LogRecord trait object (which carries its own severity()/category()/what() /details()), in info → invalid order.

Bounded: at most DOCUMENT_MESSAGE_CAP rows are loaded per severity (so the worst case is a few thousand records, never the full millions a pathological document can hold). The second return value is the MessageCounts of true per-severity totals, so a caller can render the real magnitude and flag truncation rather than silently dropping evidence. Every query is keyed by the indexed task_id and this serves a single document, never a hot path; a failed sub-query contributes no rows rather than erroring the whole report.