diff --git a/src/repo/postgres.rs b/src/repo/postgres.rs index addba2b..cf36b9c 100644 --- a/src/repo/postgres.rs +++ b/src/repo/postgres.rs @@ -354,11 +354,11 @@ impl HashRepo for PostgresRepo { .or_filter(created_at.eq(timestamp).and(hash.gt(&bound_hash))) .order(created_at) .then_order_by(hash) - .offset(limit.saturating_sub(1) as i64) - .first::(&mut conn) + .limit(limit as i64) + .get_results::(&mut conn) .await - .optional() - .map_err(PostgresError::Diesel)?; + .map_err(PostgresError::Diesel)? + .pop(); (page, prev) } else {