javascript - Make Xdebug ignore multiple requests

I have several places in my app where I call an API endpoint every 60 seconds.

When I try to debug with Xdebug the controller that is associated to that endpoint it often takes me more than a minute while I think/step over and so on, so I end up getting another request that Xdebug intercepts at the same previous breakpoint (I get two lines highlighted and actually when I step over again it will start from the new request onwards).

Is there a way to tell Xdebug to temporarilly ignore future requests being intercepted by Xdebug? Of course I could comment the JS part where I do the setTimeout to call again to the same endpoint but I would like to know if there's an alternative that doesn't imply tinkering with my code.

Thanks in advance.

Answer

Solution:

The latest version (1.21.0) of VS Code PHP Debug adapter supports this via the maxConnections launch.json setting.

Example showing max 2 parallel connections allowed. If logging is enabled, a line will be printed if a new connection is rejected.

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Listen for Xdebug",
      "type": "php",
      "request": "launch",
      "port": 9003,
      "maxConnections": 2,
      "log": true
    },

Answer

Solution:

You can't do this on the Xdebug side, but:

If you are using PhpStorm, you can set the "Max. Simultaneous Connections" setting to 1. It is (in my version) under "PHP", "Debug", "External Connections".

Source