If it's just flowing, it's just a matter of money to fix it - for the water consumed. The mechanism (the most common) is made so that the tank does not overflow. An overflow is created there and at a certain water level the water drains. If you have a working cap, stop the water. During the visit to the toilet, you release the water, rinse it and stop the water again.