I think two years or so.
That doesn't seem very long. My Gran has some goldfish and they are all over 10 years old, and two of them are 14 years! She has them in a very big tank and keeps the numbers of fish in it down so they all have plenty of room to swim around, and lots of little cave things for them to hide in when they are feeling stressed or just want to be alone. Gran spends lots of money on her goldfish and reads up (actual real books, shelves full of them!) all she can on them. When we were younger we weren't allowed put our grubby little hands into the tank water to tickle the fish, in case they got poisoned from chocolate or sweet residue or other stuff. She still lost a few over the years, would spend a pile of money on making the sick ones get better but they usually died anyway. But apart from that, it all seems to work and now she has some nice big plump and old goldfish.