Alkaar / resy-booking-bot

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

OutOfMemoryError: Java heap space #97

Open m4rtint opened 1 year ago

m4rtint commented 1 year ago

Hey there, OS: Windows Run method: SBT + JDK

############
# ResyKeys #
############
# Your user profile API key. Can be found once you're logged into Resy in most "api.resy.com" network
# calls (i.e. Try they "/find" API call when visiting a restaurant). Open your web console and look for a request header
# called "authorization".
# e.g.
# resyKeys.api-key="MY_API_KEY"
resyKeys.api-key="xxxxxxxxxx"
# Your user profile authentication token when logging into Resy. Can be found once you're logged into
# Resy in most "api.resy.com" network calls (i.e. Try the "/find" API call when visiting a restaurant). Open your web
# console and look for a request header called "x-resy-auth-token".
# e.g.
# resyKeys.auth-token="MY_AUTH_TOKEN"
resyKeys.auth-token="xxxxxxx"

######################
# ReservationDetails #
######################
# The date you want to make the reservation in YYYY-MM-DD format. This should be set to the day after the
# last available day with restaurant reservations as this is the day you want to snipe for a reservation once they
# become available.
# e.g.
# resDetails.date="2099-01-30"
resDetails.date="2024-01-30"
# Size of the party reservation
# e.g.
# resDetails.party-size=2
resDetails.party-size=2
# The unique identifier of the restaurant you want to make the reservation at. Can be found when viewing
# available reservations for a restaurant as a query parameter in the `/find` API call if you have the web console open.
# e.g.
# resDetails.venue-id=123
resDetails.venue-id=123
# Priority list of reservation times and table types. Time is in military time HH:MM:SS format. This
# allows full flexibility on your reservation preferences. For example, your priority order of reservations can be...
#   * 18:00 - Dining Room
#   * 18:00 - Patio
#   * 18:15
#   If you have no preference on table type, then simply don't set it and the bot will pick a reservation for that time
#   slot regardless of the table type.
# e.g.
# resDetails.res-time-types=[
#     {reservation-time="18:00:00", table-type="Dining Room"},
#     {reservation-time="18:00:00", table-type="Patio"},
#     {reservation-time="18:15:00"}
# ]
resDetails.res-time-types=[
    {reservation-time="18:00:00", table-type="Dining Room"},
     {reservation-time="18:00:00", table-type="Patio"},
    {reservation-time="18:15:00"}
]

#############
# SnipeTime #
#############
# Hour of the day when reservations become available and when you want to snipe
# e.g.
# snipeTime.hours=9
snipeTime.hours=19
# Minute of the day when reservations become available and when you want to snipe
# e.g.
# snipeTime.minutes=0
snipeTime.minutes=21

Tried to run this script, however i'm getting out of memory error. unsure if it's my config, or my setup.

[INFO ] 2023-03-14 19:19:58.688-07:00 ResyBookingBot$:16 - Starting Resy Booking Bot
[INFO ] 2023-03-14 19:19:59.444-07:00 ResyBookingBot$:45 - Next snipe time: 2023-03-14T19:21:00.000-07:00
[INFO ] 2023-03-14 19:19:59.445-07:00 ResyBookingBot$:46 - Sleeping for 0 hours, 0 minutes, and 58 seconds
[success] Total time: 2 s, completed Mar 14, 2023, 7:19:59 PM
Caught exception class java.lang.OutOfMemoryError logging exception class java.lang.OutOfMemoryError
java.lang.OutOfMemoryError: Java heap space
        at java.base/java.util.Arrays.copyOfRange(Arrays.java:3822)
        at java.base/java.lang.StringLatin1.newString(StringLatin1.java:769)
        at java.base/java.lang.StringBuilder.toString(StringBuilder.java:453)
        at org.apache.logging.log4j.message.ParameterizedMessage.getFormattedMessage(ParameterizedMessage.java:204)
        at org.apache.logging.log4j.message.ParameterizedNoReferenceMessageFactory.newMessage(ParameterizedNoReferenceMessageFactory.java:105)
        at org.apache.logging.log4j.message.AbstractMessageFactory.newMessage(AbstractMessageFactory.java:99)
        at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:2057)
        at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1931)
        at org.apache.logging.log4j.spi.AbstractLogger.warn(AbstractLogger.java:2805)
        at org.apache.logging.log4j.spi.AbstractLogger.handleLogMessageException(AbstractLogger.java:2225)
        at org.apache.logging.log4j.spi.AbstractLogger.tryLogMessage(AbstractLogger.java:2208)
        at org.apache.logging.log4j.spi.AbstractLogger.logMessageTrackRecursion(AbstractLogger.java:2159)
        at org.apache.logging.log4j.spi.AbstractLogger.logMessageSafely(AbstractLogger.java:2142)
        at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:2058)
        at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1931)
        at org.apache.logging.log4j.spi.AbstractLogger.warn(AbstractLogger.java:2805)
        at org.apache.logging.log4j.spi.AbstractLogger.handleLogMessageException(AbstractLogger.java:2225)
        at org.apache.logging.log4j.spi.AbstractLogger.tryLogMessage(AbstractLogger.java:2208)
        at org.apache.logging.log4j.spi.AbstractLogger.logMessageTrackRecursion(AbstractLogger.java:2159)
        at org.apache.logging.log4j.spi.AbstractLogger.logMessageSafely(AbstractLogger.java:2142)
        at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:2058)
        at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1931)
        at org.apache.logging.log4j.spi.AbstractLogger.warn(AbstractLogger.java:2805)
        at org.apache.logging.log4j.spi.AbstractLogger.handleLogMessageException(AbstractLogger.java:2225)
        at org.apache.logging.log4j.spi.AbstractLogger.tryLogMessage(AbstractLogger.java:2208)
        at org.apache.logging.log4j.spi.AbstractLogger.logMessageTrackRecursion(AbstractLogger.java:2159)
        at org.apache.logging.log4j.spi.AbstractLogger.logMessageSafely(AbstractLogger.java:2142)
        at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:2058)
        at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1931)
        at org.apache.logging.log4j.spi.AbstractLogger.warn(AbstractLogger.java:2805)
        at org.apache.logging.log4j.spi.AbstractLogger.handleLogMessageException(AbstractLogger.java:2225)
        at org.apache.logging.log4j.spi.AbstractLogger.tryLogMessage(AbstractLogger.java:2208)
Alkaar commented 1 year ago

I feel it's your setup. Try to increase the memory in sbt and see if that helps (see link below). https://www.baeldung.com/scala/sbt-heap-size

You can also pass it as an argument when you run sbt to increase the memory (e.g. sbt -J-Xmx2G). This will set your max heap memory to 2G.