When do they stop giving magnesium iv to stop labour ?

I’ve had a few preterm labour scares but never put on it and now reading a whole bunch of scary stories