It depends on the CLTV (CHECKLOCKTIMEVERIFY) value of the routed HTLC.
LND channels take 2016 blocks (2 weeks) max by default, but it needs to be lower with the cltv_delta value with every hop where it is routed.
https://github.com/lightningnetwork/lnd/blob/6e0a67d05bd375c4b39db53dc45df74157227a57/sample-lnd.conf#L378
Other implementations have the max value lower at 144.
@npub1p2psats79rypr8lpnl9t5qdekfp700x660qsgw284xvq4s09lqrqqk3m82sets it to 24h (144 blocks) for maximum compatibility.