Stopping a Django Model function being run more than once, at once
What you can do is lock the slot for the booking once the payment is initiated. That way you only "lose" availability for a few moments. The lock can be done on the same centralized system that holds the rest of the information. For instance you can scale up the application servers but keep a single entry point to the data source.
You release the lock once the payment is declined or confirm.
I have a Django Model class for a booking slot. Once we have all the auxiliary data and payment is ready to be made, we get a live availability and allocate a booking. This whole last step of the process takes a couple of seconds (mostly waiting on the payment provider to clear). In theory two payments coming through at once could double-book a slot.
That's all handled by a single function Booking.book(). Is there any sane way I can limit so that only one instance can work at once and others are queued?
The deployment design is initially pretty simple but there could be scale to multiple servers eventually. 
What's the proper way of doing this and what are its downsides?