Skip to content

Commit

Permalink
collab: Fetch more meters and prices when initializing StripeBilling (
Browse files Browse the repository at this point in the history
#19288)

This PR makes it so we fetch more meters and prices when initializing
`StripeBilling`, as we have more than 10 meters defined.

Release Notes:

- N/A
  • Loading branch information
maxdeviant authored Oct 16, 2024
1 parent 834d50f commit 9c3d80d
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions crates/collab/src/stripe_billing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ impl StripeBilling {

let (meters, prices) = futures::try_join!(
StripeMeter::list(&self.client),
stripe::Price::list(&self.client, &stripe::ListPrices::default())
stripe::Price::list(
&self.client,
&stripe::ListPrices {
limit: Some(100),
..Default::default()
}
)
)?;

for meter in meters.data {
Expand Down Expand Up @@ -396,9 +402,12 @@ impl StripeMeter {

pub fn list(client: &stripe::Client) -> stripe::Response<stripe::List<Self>> {
#[derive(Serialize)]
struct Params {}
struct Params {
#[serde(skip_serializing_if = "Option::is_none")]
limit: Option<u64>,
}

client.get_query("/billing/meters", Params {})
client.get_query("/billing/meters", Params { limit: Some(100) })
}
}

Expand Down

0 comments on commit 9c3d80d

Please sign in to comment.