That sucks, but that's one of the realities of bakeries. They get a rush of customers, they sell out of pastries, and it takes a certain amount of time and effort to prep new ones. It's a big let-down, though. I'd suggest finding out their normal production schedule and get there early.
The largest production is done to be full for early morning. All dough is proofed and then baked. That in itself is a ling process. Donuts have short lifespans, thus, production for evenings are small.
Thanks! Your answer is awaiting moderation.