Yeah the lines queing up at immigration to fill out last minute TDAC is huge. Best to do it right before you depart. Make sure you use the official Thai government website and not one of the pay scam sites.
Official Thailand Digital Arrival Card (TDAC) – No Fees Required