Alkaar / resy-booking-bot

🔫 Helps to snipe hard to get reservations at restaurants that use resy
409 stars 215 forks source link

Retry when results are empty #25

Closed jirvine89 closed 2 years ago

jirvine89 commented 2 years ago

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.

Alkaar commented 2 years ago

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.

Alkaar commented 2 years ago

I merged in a fix @jirvine89 here 👉 https://github.com/Alkaar/resy-booking-bot/pull/26 Feel free to take a look and of no concerns, I can close this issue.

jirvine89 commented 2 years ago

Thanks! That's exactly how I changed my version