It varies for me, depending on the rub and the meat. Also what I want to achieve.
In general, if it is just salt and pepper based, within 30 minutes of going on the fire. If it has more sugar or spices in it, I like to let it melt onto the meat, that means more like an hour. For some meats, like chicken, I will rub it, then wrap tight or place in ziploc with air sucked out, for 4 to 8 hours.