If I sell my primary home next year, but take down payment money this year, do I lose the exemption from capital gains on money accepted in either year?

For example, future buyer puts down $150,000 on a $300,000 sale price in 2021, but cannot complete the sale until 2022 at which time another $150,000 is paid. Can my income be spread across 2 tax years and still be exempt from capital gains?