Beam loss rates with an internal gas target in an electron-cooled storage ring Implications for luminosity optimization