Skip to content

Conversation

Sundaresan-Karunakaran
Copy link
Contributor

This PR fixes the issue #232 where rapidly zooming/panning caused a race condition, leading to incorrect outputs and inefficiency.

Problem

When users rapidly zoom in and out or pan the map, multiple requests to fetch stops are triggered in quick succession. This can lead to:

  • A race condition where older requests resolve after newer ones, causing outdated or inconsistent data to be displayed.
  • Inefficiencies due to unnecessary network requests fetching data that is no longer needed.

Solution

  • Implemented an AbortController to cancel previous fetch requests before making a new one.
  • Moved the cancellation logic to loadStopsAndAddMarkers to ensure every request is controlled properly.
  • Ensured only the latest valid response updates the stop data.

Sundaresan-Karunakaran and others added 6 commits March 21, 2025 12:44
…ondition

Fixed race condition in stopPane
Repeated zoom in and out in the mapview creates many api calls. this code drops all the calls except the newest one so that race conditions can be avoided and improved efficiency.
…w-race-condition

Revert "Fixed race condition in MapView"
@Sundaresan-Karunakaran Sundaresan-Karunakaran marked this pull request as ready for review March 28, 2025 23:21
@coveralls
Copy link

Coverage Status

coverage: 16.097%. remained the same
when pulling 50b574d on Sundaresan-Karunakaran:main
into d4b0cd3 on OneBusAway:main.

@Sundaresan-Karunakaran
Copy link
Contributor Author

@aaronbrethorst
Apologies, I attempted to squash the commits before submitting, but I couldn't find the option here as I did in my forked repo. Next time, I'll handle it from the CLI directly to make it easier.

Sorry for any confusion!

@aaronbrethorst aaronbrethorst requested a review from Copilot March 30, 2025 00:31
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

@Sundaresan-Karunakaran
Copy link
Contributor Author

Hi @aaronbrethorst, I saw that the PR was closed, but I didn’t get any feedback before that. I just want to understand if there’s anything I could improve or if it was closed for another reason. Appreciate your time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants