It depends on the person and how interested they are in gambling, so I don't think it can be measured in terms of time, and only awareness will make you not do it anymore and really think that this is just an activity that is a waste of time and money.
But maybe it's best if someone is over 40 or 50 years old, he can stop gambling and look for other activities so that he won't return to gambling. This is to refresh his mind and be able to enjoy his life well without gambling. But it really depends on the person because someone will stop gambling because of their own decision.
Well assuming to quit in old age could be a good option, because you wouldn't want to be stuck in that cycle forever, and it's true that it depends on the person's decision.