fetch_and_store

Function fetch_and_store 

Source
pub(crate) async fn fetch_and_store(
    client: &Client,
    pool: &PgPool,
) -> Result<usize, FetchError>
Expand description

Fetches the Pi-Star host file and upserts all reflectors into Postgres.

Returns the number of reflectors successfully upserted. Reflectors with unrecognised protocol types are skipped with a debug log.

§Errors

  • FetchError::Http if the HTTP request fails or returns a non-2xx status.
  • FetchError::Database if any database upsert fails. Note: a database error on one row aborts the entire batch (fail-fast) — this is acceptable because the next poll cycle will retry the full set.