I am trying to using mongo in a serverless environment (vercel’s now). But I am constantly deailing with my connection just dying.
What does my code do?
- I have a list of 1000 blogs
- I scan the blog for new posts via RSS feed
- I potentially add the post to my db if some criteria are met
So a call to my /scan-blogs API endpoint will potentially scan and add hundreds of blog posts. All of this was working fine on mLab, but after switching to Atlas I’ve had to really put a limit on concurrency of these scans to dance around the connection limit.
Here is my shared db utility that I use in all of my serverless function
and here are the errors that I keep getting, about 1/3 of the requests fail.