In Clash of Clans, you can be AFK for up to 3 minutes before your troops start to attack the nearest village.