Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gtfs module is now also looking at next day. #20482

Closed
wants to merge 2 commits into from

Conversation

asirinelli
Copy link

If no trip has be found today, the next trip tomorrow is returned.
This should close #7956.

Description:

Related issue (if applicable): fixes #7956

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New or updated dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

If no trip has be found today, the next trip tomorrow is returned.
This should close home-assistant#7956.
@homeassistant
Copy link
Contributor

Hi @asirinelli,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

flake8 reported a blank line should be removed.
@renemarc
Copy link
Contributor

Hi @asirinelli,

We both came up with solutions for next-day departures, great minds think alike! 😃 Your approach makes sense, but running that second query is expensive in terms of I/O on a Raspberry Pi's SD card since the original query is already slow to begin with.

I am trying to optimize the GTFS sensor as much as possible, and came up with a series of upgrades that would reduce expensive I/Os like the original query does. Some have PRs ready, others are awaiting in the pipeline for these building blocks to be approved first.

As an alternative, PR #20992 runs an optimized initial query only once, capturing all data from yesterday, today and tomorrow then filters the relevant dates in code. Would you like to give it a try?

@robbiet480
Copy link
Member

Closing in favor of #20992

@robbiet480 robbiet480 closed this Mar 25, 2019
@ghost ghost removed the in progress label Mar 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GTFS indicates 0 if no more departure today
4 participants