Timeout on Admin-Ajax?

There is always a timeout, be it TCP or the PHP execution time ( unless you configure your server in a weird way, PHP will kill long running tasks ).

If you need to do a lot of work you should:

Break it into smaller pieces

Plugins like regen thumbnails retrieve a list of items to do work on, then go through the list in small fast batches keeping track of what’s been done as it goes along. You can do 10 minutes worth of work, but instead of 1 million things in 1 request, it’s better to do 1 thing in 1 million requests.

WP CLI

Expensive lengthy work shouldn’t be done on the frontend. It should be done on the command line. This is the best method and recommended.

Implement a WP CLI command that does what you need to do, and run it. This bypasses the PHP execution timeout completely, as well as any connection timeouts that might happen. WP CLI commands could run for hours if your code has enough system resources and cleans up after itself to prevent memory leaks. If you need to pass in data, do so using parameters.

if you don’t have CLI access, you’re either using a managed host service, or a shared hosting service, in which case you should either move host ( shared hosting is problematic ), or download the site to your local machine and run the CLI command locally, then upload the results