It would have remained on the network till majority of nodes have dropped it from their mempool. It could still be rebroadcasted by some so there is no specific length of time. The default mempool retention period is 2 weeks.
The problem is that rebroadcasting by some nodes can create an endless loop where the now rebroadcasted transaction keeps showing up over and over again even in the mempools of nodes that dropped it. The best thing to do is to wait until the transaction drops below the purging rate, then find an Electrum server that dropped it, which should allow you to cancel it.