I saw a video of Arash rabhar where he mention masturbation doesnt causes any muscle loss or affect the gains. just don’t do it close to hours when you have your workout scheduled.
and excess of anything could led to some kind ko effect.
One should consider all other factors first (nutrition, sleep, rest,..) before he tries to find a perfect timing to j*** off in order to avoid some kind of decrease in muscle growth or even loss
Just my 2 cents