Random 502 error when publishing new content

I think this thread may help you: Issues Syncing Redhat yum repositories - #15 by Justin_Sherrill?

Keep in mind that this will be wiped out by an installer run.

in 4.0, some timeouts were increased which may help with a larger bulk size
in 4.1, this setting has been moved to a setting under Admister > Settings which survives installers runs