How to prevent background-function spamming

Short answer is, you can’t.

Take a look at: