SE call this "CC cooldown", they explained it in 1.21 patch notes and the mechanism hasn't changed since then (although some timers may have been adjusted).
The first time you apply a CC effect, you get the full duration and a timer starts. When the timer ends, you can apply the CC effect again with full duration (and the timer starts again).
If you (or any other player) tries to apply the effect again when the timer is running, you only get half duration.
If you apply it once more, you get a quarter of the initial duration.
If you try again, the effect won't be applied at all (fully resisted).
Thus, for Flash you have 12, 6, 3, then full resist.
For shield bash/stun you have 6, 3, 1.5
Flash cooldown: 180s
Stun cooldown: 30s
Pacification cooldown: 300s
(I cannot guarantee the accuracy of these, but you get the idea)
Other CC effects have their own cooldown but I didn't memorize them since I play PLD only.
Once you get this, you can predict exactly when your stun won't work, for example during Ifrit (if you interrupt a plume by mistake or if another player uses stun).