Can ranting be a form of buffering?

My husband and I are struggling in our marriage and I notice that compared to when we were getting along well, nowadays he tends to indulge in negative thoughts that tend to lead to rants about his work or political/social issues. His ranting is almost daily and it’s unpleasant for me, but in trying to not have a manual for him I’m trying to move from frustration to a place of compassion so I was wondering if indulging in negative thoughts is a way that some people buffer against other painful thoughts that they are trying to avoid?

And I’m wondering if it’s acceptable for me to have a boundary in order to protect my own peace of mind such that I can walk away if he’s ranting, or is that still me having a manual for him?