Skip to content

Commit f7fdb36

Browse files
update the active subscriptions query
1 parent 0031c20 commit f7fdb36

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

  • aggregation_mode/payments_poller/src

aggregation_mode/payments_poller/src/db.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,18 @@ impl Db {
8585
&self,
8686
epoch: BigDecimal,
8787
) -> Result<i64, sqlx::Error> {
88-
let (count,) = sqlx::query_as::<_, (i64,)>(
89-
"
88+
self.orchestrator
89+
.query(async |pool| {
90+
sqlx::query_scalar::<_, i64>(
91+
"
9092
SELECT COUNT(*)
9193
FROM payment_events
9294
WHERE started_at < $1 AND $1 < valid_until",
93-
)
94-
.bind(epoch)
95-
.fetch_one(&self.pool)
96-
.await?;
97-
98-
Ok(count)
95+
)
96+
.bind(&epoch)
97+
.fetch_one(&pool)
98+
.await
99+
})
100+
.await
99101
}
100102
}

0 commit comments

Comments
 (0)