We sync with another platform, ERROR 504

A 504 error generally occurs when your origin server responds with that error code.

About timeouts:

  • Cloudflare will wait for a response for up to 100 seconds. If a timeout occurs before that, it means that your origin server has responded with a timeout (error 504).
  • If Cloudflare doesn’t get a response within 100 seconds, it will return with a 524.

Since you are getting a 504, you may want to look at adjusting the timeouts at your origin server. Cloudflare can’t do anything about this, and doesn’t offer any customisation regarding timeouts (unless on Enterprise plan).

For use cases like this, I recommend looking into a background queuing system instead.

https://support.cloudflare.com/hc/en-us/articles/218378978-What-should-I-do-after-seeing-a-502-or-504-gateway-error-on-my-site-