0

I've built a small API using Restify and Node.js. I have a PHP application sending cURL requests, but after five PUT or POST requests (10 when using CLI), the Node.js server starts refusing PUT and POST requests (but not GET requests, and I haven't tried DELETE yet) from the client that sent them.

How do I prevent this from happening? I don't want to have to restart my server every few seconds.

Dubstaphone
  • 400
  • 3
  • 16
  • Sounds like your PUT/POST handlers are hitting some sort of connection pool limit (but without any code I can only guess...). – robertklep Feb 23 '16 at 09:57
  • @robertklep what kind of code would you need? code from my PHP cURL requests, or code from my server? – Dubstaphone Feb 23 '16 at 18:36
  • @robertklep eesh, this is embarrassing; i was forgetting to close the MySQL connections after running everything, and my connection pool limit was 10 (the script ran two requests, that's why i thought it failed after five). if you hadn't said anything about the connection pool, i probably wouldn't have thought to check that. thanks! – Dubstaphone Feb 23 '16 at 18:43
  • I would just add that the reason for 5 vs 10 requests is that browsers were likely sending an OPTIONS request prior to the actual PUT/POST. – bitsoflogic Mar 04 '16 at 12:12

0 Answers0