Depreciation on rental property using 27.5 year method but with personal use of property

I own rental property and depreciate using the 27.5 year method. Can anyone provide clarity around how it works if I started the depreciation on year one, but at year five I lived in it for 2 years (personal residence). After those 2 years, it went back to rental property. In this situation, does the 27.5 year timeline bump out for 2 more years of depreciation, or does it work that once the depreciation timeline starts, it ends at 27.5 years regardless?? I can't find this info on IRS site on how to handle.
In another example scenario-if I purchase rental property and rent it out for 1 year, and use 27.5 year method. At year 2 I live in it for 25 years (personal residence). If I then rent it out again as rental property, have I lost my window to depreciate, or how does it work?