Requirement, you can claim primary residence exclusion only if you lived at the property 2 years out of 5 years before the sale.
In your case:
Total years of ownership: 2032-2004 = 28
Total years of primary residence: 2008-2004 + 2032-2030 = 6
Total years of rental: 28-6=22
Therefore, for your capital gain at 2032, 22/28 has to be taxed. and 6/28 can claim primary residence exclusion.
For example, if your capital gain is 280K, you have to pay CGT for 220K.
But if your capital gain is a huge number, and if 6/28 x capital gain > 500K, you can only claim 500K.