Close slots
Closing slots is what we have to do when a slot is no longer reservable.
Practically speaking, we will run a scheduled Lambda after each open hour, which is to say: 0700-1700 GMT Monday through Friday. You may ask "what if the slot isn't actually closed at that time?" The answer is actually pretty simple—since Lambda will only happen after the time you want it to run, plus an additional 5-20 seconds of delay before it actually executes at all, you can be sure that you are doing this when it makes logical sense: after the slot has ended.
If we had a very time-sensitive system this particular solution may have been unacceptably slow, but here it's not nearly an actual problem.
Nothing new here... The checkedForClosed()
will run an internal loop first to check that the provided loops are truly ended and then run the rest of the transactional logic for those slots that we no longer need.
Last updated