Disconnecting during a raid?

My friends and i have a realm and we all live in a village, so needless to say we’ve had our fair share of raids.

However recently, we’ve realized we have no idea of what happens if we leave the server. Do the raiders automatically win and we lose the villagers (they’re in an underground bunker which raiders can’t get to)?

Does it just wait for us to go back on and pick up where we left off?