MLB-StatsAPI icon indicating copy to clipboard operation
MLB-StatsAPI copied to clipboard

Fix Schedule Bug

Open elliottevans opened this issue 2 years ago • 2 comments

Updates:

  • Fixes bug in schedule function. As it stands, the schedule function relies on a hydrate parameter:
    hydrate = (
        "decisions,probablePitcher(note),linescore,broadcasts,game(content(media(epg)))"
    )

However, usage shows that including game(content(media(epg))) in the hydrate parameter creates unreliable behavior on calls to the schedule function, often leading to internal server errors from MLB's API:

image

The behavior appears to be stochastic, only occasionally resulting in a clean response from the MLB API.

However, removing game(content(media(epg))) entirely from the hydrate parameter appears to fix this issue.

  • Include .idea in .gitignore. For those using pycharm IDE

elliottevans avatar Oct 15 '23 21:10 elliottevans

@toddrob99 for viz

elliottevans avatar Oct 27 '23 17:10 elliottevans

@elliottevans, does the error only happen when you use a large date range? It appears the API is returning a 500 Internal Server Error when its query times out. Postman won't show me the response size with the game(content(media(epg))) included for all of 2019 because it says it's too big, but even without the game(content(media(epg))) hydration, the response for all of 2019 is 20MB. For March 2019, the response is 2.63MB without the game(content(media(epg))) hydration and 4.65MB with it. The response for the first half of 2019 is 46MB with the hydration included and 11MB without it.

I'm sure removing the hydration makes the query complete faster because it's joining fewer tables. However, removing the hydration would be a breaking change for anyone expecting the media data to be included.

Instead, I suggest reducing the date range in your requests so they can complete in a timely manner.

toddrob99 avatar Dec 18 '23 16:12 toddrob99