A rioter who set fire to a generator as a mob besieged a hotel housing asylum seekers has been jailed for six years.