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

Cancel obsolete requests #268

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

m-novikov
Copy link
Contributor

No description provided.

@m-novikov m-novikov marked this pull request as ready for review January 25, 2021 08:51
@@ -315,6 +317,12 @@ def requestRefresh(self, rectF, stack_id=None, prefetch=False, layer_indexes=Non
"""
stack_id = stack_id or self._current_stack_id
tile_nos = self.tiling.intersected(rectF)
to_cancel = self._current_requests
self._current_requests = {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Volumina's code is kinda hard to navigate, so I'd love to see some type annotations like

self._current_requests: Mapping[Tuple[LAYER_ID, ImageSource, REQUEST_ID], ArrayRequest] = {}

else:
ims_req.cancel()

self._current_requests.pop((stack_id[1], ims, tile_nr), None)
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you using pop here because the request might have been already removed from self._current_requests?

This kinda makes me think if it would be possible for a request to overwrite an older one; If I, say, load an image in a layer, make a request, drop that layer, then load another image and make another request, is it possible for the second request to overwrite the previous one? Even worse, is it possible for the second one to be cancelled when we meant to cancel the first?

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