#I_Be3X_I
1 messages ยท Page 1 of 1 (latest)
Hi. You could look into using auto pagination: https://stripe.com/docs/api/pagination/auto
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Let me check reaaly quick ๐
So, lets say that a user has 200 charges
How would we use this when making two separate calls in two separate threads
and prevent those two threads to call the same data?
Why do you need multithreading?
we will just make 1 call with each thread.
Because when we are retrieving 300000 charges from a customer, it makes the process very slow
our app connects to the customer data by querying it in real time and displaying the calculations on the Stripe App
We are currently not storing their data anywhere
Gotcha. Yeah doing that for 300,000 charges is going to be slow no matter what. You could try multithreading, but how that works will depend on your language. Also you wouldn't be able to use auto pagination if you require multithreading. You'd need to keep track of some state (like starting_after: https://stripe.com/docs/api/charges/list#list_charges-starting_after) for the queries and have the info communicated to multiple threads somehow (which will depend on your language)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Also keep in mind rate limits with threads
yup
those are exactly the problems we are having
if we use Starting_after, it is still a proble for multithreading
problem*
because we don't know how many charges are in a specific time frame. Let's say we have multiple threads and we define starting_after for them. We don't know if for a specific data range, the user had more than 100 charges (request limit). If that is the case, we will miss big chunks of data when querying it through multithreading
Yeah. It's going to be difficult to do it this way. When you're dealing with that many charges and not storing any info on your end, it's going to be slow.
Even if we store it on our end, we won't be able to process the data live for a Stripe App
which kinda makes the Stripe App ecosystem redundant since users are looking for live and instant information there. If you find any work around for this, let us know ๐
Thank for your time
What does your app do exactly? Why do you need all 300,000 charges at once?
We run forecasts
For example, we take last years data and forecast the revenue for the next month. We are also working on calculating other metrics (that also require at least 1 year of data from the user)
How do you use this : "created.gte" Using python?
it is one of the parameters, but I am not sure if it will work since it has a "."
no prob
created.gte expects a timestamp (numeric value)
Such as created.gte = 1639755688
in Python, I believe this field is a dictionary
so must be something like
"gte": 1639755688
}
This makes more sense
Alright thanks!
If you know any way to query more than 100 charges per request let us know ๐
Yeah as my colleague suggested above, you'd either use multithreading (which may run into rate limits) OR use memoization (store the data previous data/results & only run the algorithm taking in the new inputs)
Are there any plans to increase the limit per query?
None that I'm aware of
okay thanks both!
NP! ๐ Good Luck