Updating worker causes fail

Hello, I am trying to update worker from Cloudflare and it gives this error:

API Request Failed: PUT /api/v4/accounts//workers/services//environments/production?include_subdomain_availability=true (504)

When I try to update through wrangler, it also gives error:

X [ERROR] Received a malformed response from the API

This did not happen in the past, and the only change was, that it had less routes (300), now i have about 400 routes.

IN both cases, It takes too long, and then those mentioned error messages happens.

What can I do with that?

Thank you.

Why do you need that many routes?

I manage multiple domains. Thank you for your “help”