You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/fortuna/src/history.rs
+12-5Lines changed: 12 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -414,6 +414,7 @@ impl History {
414
414
&self,
415
415
chain_id:Option<ChainId>,
416
416
limit:u64,
417
+
offset:u64,
417
418
min_timestamp:Option<DateTime<chrono::Utc>>,
418
419
max_timestamp:Option<DateTime<chrono::Utc>>,
419
420
) -> Result<Vec<RequestStatus>>{
@@ -430,20 +431,23 @@ impl History {
430
431
.unwrap(),
431
432
);
432
433
let limit = limit asi64;
434
+
let offset = offset asi64;
433
435
let rows = match chain_id {
434
436
Some(chain_id) => {
435
437
let chain_id = chain_id.to_string();
436
-
sqlx::query_as!(RequestRow,"SELECT * FROM request WHERE chain_id = ? AND created_at >= ? AND created_at <= ? ORDER BY created_at DESC LIMIT ?",
438
+
sqlx::query_as!(RequestRow,"SELECT * FROM request WHERE chain_id = ? AND created_at >= ? AND created_at <= ? ORDER BY created_at DESC LIMIT ? OFFSET ?",
437
439
chain_id,
438
440
min_timestamp,
439
441
max_timestamp,
440
-
limit).fetch_all(&self.pool).await
442
+
limit,
443
+
offset).fetch_all(&self.pool).await
441
444
}
442
445
None => {
443
-
sqlx::query_as!(RequestRow,"SELECT * FROM request WHERE created_at >= ? AND created_at <= ? ORDER BY created_at DESC LIMIT ?",
446
+
sqlx::query_as!(RequestRow,"SELECT * FROM request WHERE created_at >= ? AND created_at <= ? ORDER BY created_at DESC LIMIT ? OFFSET ?",
444
447
min_timestamp,
445
448
max_timestamp,
446
-
limit).fetch_all(&self.pool).await
449
+
limit,
450
+
offset).fetch_all(&self.pool).await
447
451
}
448
452
}.map_err(|e| {
449
453
tracing::error!("Failed to fetch request by time: {}", e);
0 commit comments