R

Railway

βœ‹ο½œhelp

Join Server

API limitations

MMalindu5/24/2023
Does Railway have an API call limit per service in the free account? I am running a cron job that involves a set of external API calls in a loop. However, it stops after executing 20 APIs. I have tested it locally, and it works fine. I would like to know the limitations of the Railway server.

Project ID: dd417141-599f-4431-bbf6-538cbc507f1d
Bbrody5/24/2023
railway has no limitations on the amount of calls your app can make to external services, you are likely being rate limited by the external service
MMalindu5/24/2023
Thank you I'll check with them.
Bbrody5/24/2023
what errors do you see on the 21st api call?
MMalindu5/24/2023
No errors, Just stop
MMalindu5/24/2023
I have added logs to monitor the pages.

1 page = 1 API call
Bbrody5/24/2023
you probably aren't logging errors when they occur
Bbrody5/24/2023
would you mind sharing what this external service is?
MMalindu5/24/2023
yes, I have missed to add logs to see errors. I'll add and test again.

CommerceLayer is the external service which I am using.
Bbrody5/24/2023
and why the need for making consecutive api calls?
MMalindu5/24/2023
They have a page limit, and we need to make multiple calls to retrieve all the data.
MMalindu5/24/2023
Ex: "meta": {
"record_count": 598,
"page_count": 24
},
Bbrody5/24/2023
they have that limit for a reason πŸ˜‰
MMalindu5/24/2023
To get all 598 records, we have to call 24 times the API
Bbrody5/24/2023
they obviously dont appreciate you scanning through all the pages
Bbrody5/24/2023
and if they don't appreciate that kind of activity, railway wont appreciate that activity either
MMalindu5/24/2023
I my business requirement, I have to gather all the data per 5min. πŸ™‚
MMalindu5/24/2023
This task is already working with Vercel, There I have to use multiple cron jobs to handle the load. Because they are having time limitations for long running services.
MMalindu5/24/2023
That's the reason to move with Railway
MMalindu5/24/2023
I'm not sure this time CommerceLayer side also having any issues, I'll talk with them also.
Bbrody5/24/2023
very good chance they just tell you to stop scraping their api
Bbrody5/24/2023
and thats kinda what im telling you too
MMalindu5/24/2023
Without looping their API, There is no way to get all the data.
MMalindu5/24/2023
That's the problem.
Bbrody5/24/2023
the problem is why do you need to scrape their api for the data every 5 minutes
MMalindu5/24/2023
I have to run 320 times to gather our production data πŸ˜…
Bbrody5/24/2023
it also sounds like you should be on the railway teams plan
MMalindu5/24/2023
Sorry, I can't explain the whole business logic in this thread. By the way, this is an API for extracting product details. When the product stock levels change from CommerceLayer side, we need to update our inventory every 5 minutes.

Because Our inventory DB is the middleman used to expose stock levels to external services.
MMalindu5/24/2023
Can you explain a bit why I need to move for Railway Teams plan?
Bbrody5/24/2023
please find a different way to gather this data without loops, you are abusing CommerceLayer's api and CommerceLayer could decide to ban railway cloud, thus blocking anyone else on railway from using CommerceLayer
Bbrody5/24/2023
the bigger issue is the abuse of CommerceLayer, but you would need to be on the teams plan because it sounds like you have a commercial product
MMalindu5/24/2023
yes, I'll talk with our team, But this is my research to find a suitable service for our problem.
Bbrody5/24/2023
in the interest of not getting external services to block railway, i will be asking the team to look into your use of the railway platform, no hard feelings
MMalindu5/24/2023
Okay, no problem. I'll contact you again further more assistant on this case.
Aangelo5/24/2023
hey @Malindu - whats the purpose? Research, what university?
MMalindu5/24/2023
I'm a kind of R&D developer, So, I'm researching a suitable service for the project.
IImLunaHey5/24/2023
I would suggest looking at their rate limiting docs. You likely want to use an existing SDK or wrapper that handles the rate limiting headers and backs off accordingly.

https://docs.commercelayer.io/core/rate-limits