Alkaar/resy-booking-bot

Retry when results are empty

jirvine89 opened this issue · 3 comments

First of all, thank you so much for creating this! This is so awesome and I've already used it to get a booking I could never get.

This is my first time with Scala code or click bots, so take this with a grain of salt... I'm trying to understand the behavior when the response for available times is empty, e.g. we make the request a few milliseconds before the restaurant posts availabilities. I think what happens in this case is that results in retryFindReservation will yield Success but with an empty list. The code will then call findReservationTime, which will recursively run through the times against an empty list, and finally throw an error.

In the case where our fist request was a little too early, we would want to recurse in the retryFindReservation, which can repeat the request, potentially getting the actual availabilities, until timeLeftToRetry goes to zero.

I changed this in my local version of your code. That said, it did seem to work before I made that change, so I'm not confident this is an actual concern.

Thanks for the compliments! Glad you were able to find it useful!

I see what you mean by what you described and was able to reproduce it. I do recall this working in the past but I must have made a modification that broke this behavior. I must have been lucky to not encounter it so thanks for catching it. I'll put in a fix for this.

I merged in a fix @jirvine89 here 👉 #26
Feel free to take a look and of no concerns, I can close this issue.

Thanks! That's exactly how I changed my version