Skip to content

Properly dequeue cancelled events when multiple apps are rendered#2540

Merged
freddyaboulton merged 3 commits into
mainfrom
properly-dequeu-cancelled-events-multiple-blocks
Oct 26, 2022
Merged

Properly dequeue cancelled events when multiple apps are rendered#2540
freddyaboulton merged 3 commits into
mainfrom
properly-dequeu-cancelled-events-multiple-blocks

Conversation

@freddyaboulton
Copy link
Copy Markdown
Collaborator

@freddyaboulton freddyaboulton commented Oct 26, 2022

Description

Continuation of #2530

Cancelled events were not properly dequeued because the background task was not cancelled. You can see that here:

Not dequeued (main)

not_dequeued

Dequeued (this pr)

properly_dequeued

The fix is to also update the fn indices in the cancel functions. I thought about giving the dependencies an id that's invariant to the number of dependencies in the demo but that would be a bigger change that doesn't seem worth it when adding an if statement to render fixes the issue.

Checklist:

  • I have performed a self-review of my own code
  • I have added a short summary of my change to the CHANGELOG.md
  • My code follows the style guidelines of this project
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

A note about the CHANGELOG

Hello 👋 and thank you for contributing to Gradio!

All pull requests must update the change log located in CHANGELOG.md, unless the pull request is labeled with the "no-changelog-update" label.

Please add a brief summary of the change to the Upcoming Release > Full Changelog section of the CHANGELOG.md file and include
a link to the PR (formatted in markdown) and a link to your github profile (if you like). For example, "* Added a cool new feature by [@myusername](link-to-your-github-profile) in [PR 11111](https://github.com/gradio-app/gradio/pull/11111)".

If you would like to elaborate on your change further, feel free to include a longer explanation in the other sections.
If you would like an image/gif/video showcasing your feature, it may be best to edit the CHANGELOG file using the
GitHub web UI since that lets you upload files directly via drag-and-drop.

@github-actions
Copy link
Copy Markdown
Contributor

All the demos for this PR have been deployed at https://huggingface.co/spaces/gradio-pr-deploys/pr-2540-all-demos

@freddyaboulton freddyaboulton force-pushed the properly-dequeu-cancelled-events-multiple-blocks branch from 302dfa9 to ca58b48 Compare October 26, 2022 15:50
@freddyaboulton freddyaboulton marked this pull request as ready for review October 26, 2022 15:56
@abidlabs
Copy link
Copy Markdown
Member

Good catch @freddyaboulton!

Copy link
Copy Markdown
Member

@abidlabs abidlabs left a comment

Choose a reason for hiding this comment

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

Tested, very cool @freddyaboulton

@freddyaboulton
Copy link
Copy Markdown
Collaborator Author

Thank you for the review @abidlabs ! Will merge once CI finishes

@freddyaboulton freddyaboulton merged commit 099e1e8 into main Oct 26, 2022
@freddyaboulton freddyaboulton deleted the properly-dequeu-cancelled-events-multiple-blocks branch October 26, 2022 20:29
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.

2 participants