I don't think you need a flag here, do you? Can't you just disable the button? And then set a timeout to renable it?