Be not excessive in your mortifications, reasonable and fair in your expectations, build upon your earlier successes for the glory of God. What I mean is, if you struggle with it so much then aim first to control your impulse to masturbate.
I started smoking again rather than masturbate since I reasoned that it was easier for me to quit (having done numerious times and for years at a time) and only a venial sin if not in excess I mean amirite cmon. That didn’t work since I started beating it again when I quit smoking with finality, but I have since put a good end to both with intentioned prayer and God’s grace.
What matters most is the struggle and effort you put in, and that you make space in your mind for holiness.
Stop using the internet so much. If you failed a test and got news of these shootings all the way over wherever and it effected you that deep, scrutinize your Internets usage. Get off the Facebook or something, quit the games. There’s a whole network of related impulses there. Quit staring at the screen.