It's 1.12, so naturally, if you hit too fast you won't do any damage. If you're referring to something else, I have no idea.
The best to do is wait for you hit cool down to finish before you hit a mob again as mobs become immune to hits if hit to fast BLAZE boss for example.