Is pnr different on the 2 flights?
Last year when I went, I had taken free transit visa online. It came instantly on email after filling form, which took 5-10 mins. But since my PNR was same, I didn't had to cross immigration point. In Colombo, Departure and Arrival happens in same area. So, none checked my transit visa.
Things may have changed though. So, do double check from someone who went recently.