It not only depends on time, but also the pressure you use and the condition of the tissue being rolled. You really have to just listen to your body and maybe even experiment sometimes to figure out how much is too much. I find that if I’ve been rolling the same muscle for awhile (5 minutes) and the pain still hasn’t decreased, it is a good idea for me to stop and give it a break.
I’ve kept rolling before and it made the muscle feel sore the next day. The actual amount of time will vary from person to person of course. A good way to think about foam rolling is that you don’t have to get rid of everything at once, just work on a few trigger points each session.