lgrees / resy-cli

A CLI to easily schedule restaurant reservations in advance.
MIT License
34 stars 11 forks source link

Bot not quick enough? #6

Closed sethtrei closed 1 year ago

sethtrei commented 1 year ago

Been trying to use this bot for a specific restaurant for a few days now, and it never is able to see any openings when it goes off at 9am. My guess is that the bot isn't quick enough when reservations open. It works fine for instant booking at restaurants with availability.

lgrees commented 1 year ago

Hey! Thanks for checking it out. I'd definitely check the logs (resy log view) to see the output for this particular problem (I encountered this frequently myself which is why I added this feature).

It's often the case that some restaurants won't release any slots that match your constraints. Hope this helps.

sethtrei commented 1 year ago

Hm, I wonder if that could be it! Here are the logs in case you were curious:

{"level":"info","booking_details":{"reservation_times":"17:00:00,17:15:00","reservation_types":"","reservation_date":"2023-09-04","party_size":"3","venue_id":"1505","booking_datetime":"2023-08-29 09:00:00"},"time":"2023-08-29T08:59:17-04:00","message":"starting book job"} {"level":"info","time":"2023-08-29T08:59:17-04:00","message":"waiting 42 seconds until booking time: 2023-08-29 09:00:00"} {"level":"error","error":"no slots for date","time":"2023-08-29T09:00:00-04:00","message":"failed to fetch slots"} {"level":"info","time":"2023-08-29T09:00:00-04:00","message":"retrying book job"} {"level":"error","error":"no slots for date","time":"2023-08-29T09:00:00-04:00","message":"failed to fetch slots"}

lgrees commented 1 year ago

Yeah this seems plausible - this is where this is from in the source:

    if len(res.Results.Venues) == 0 || len(res.Results.Venues[0].Slots) == 0 {
        return nil, errors.New("no slots for date")
    }

Some restaurants do some weird stuff when it comes to releasing slots. And of course, this project will immediately suffer if there's a breaking change to the API. Hope that clarifies. Mind if I close?

sethtrei commented 1 year ago

Do you think it's possible that the cli is just missing reservations because it's starting too late? Like I am talking about it sending the API request right before the time (maybe 100 milliseconds before) so that resy receives it the instant it becomes available.

lgrees commented 1 year ago

It's possible, but this particular error suggests that there are 0 slots even outside of your constraints. This seems pretty rare. The current code waits 200 milliseconds after the stated slot open time to book. If I recall, I think I ran into issues where the bot was too fast if I didn't add a slight delay. This isn't configurable at the moment, but if you want, you can edit this and compile from source.

Though from my experience, Don Angie isn't worth it 😄 . This is definitely one of the cases of restaurants artificially restricting slots. Better off at l'Artusi in the area IMO.

sethtrei commented 1 year ago

Gotcha. Ty!