That depends on your circumstances. There may be an 18 month limit in some situations.[0]
[0]https://arstechnica.com/tech-policy/2020/02/man-who-refused-...
[0]https://arstechnica.com/tech-policy/2020/02/man-who-refused-...
It's different when you're a defendant or a party to the proceeding.
> After losing that appeal, Rawls raised another challenge: the federal statute that allows judges to hold witnesses in contempt for refusing to testify, passed in 1970, states that "in no event shall such confinement exceed eighteen months."
This limit does not apply if you are not a witness.