Refactor: CrawlerBase and PermissionsManager snapshotting pattern#2402
Merged
Refactor: CrawlerBase and PermissionsManager snapshotting pattern#2402
CrawlerBase and PermissionsManager snapshotting pattern#2402Conversation
…hot pattern as the other crawlers. The PermissionsCrawler predates the CrawlerBase implementation and hadn't been updated to use the current pattern.
…es is part of the interface.
CrawlerBase and PermissionsManager snapshotting pattern
|
✅ 152/152 passed, 19 skipped, 2h49m32s total Running from acceptance #5565 |
## Changes This PR is stacked on top of #2402 and is further refactors the crawler snapshotting pattern to use common code without changing the existing system behaviour. This is intended as groundwork to the next step, whereby `snapshot()` will be updated to support refreshing the inventory. ### Linked issues Progresses #2074, stacked on top of #2402. ### Tests - existing unit tests (with minor updates) - existing integration tests
nfx
requested changes
Sep 5, 2024
|
|
||
| def has_groups(self) -> bool: | ||
| return len(self.snapshot()) > 0 | ||
| first_element = islice(self.snapshot(), 1) |
Collaborator
There was a problem hiding this comment.
can you revert the change on this method? i find it risky. it's fine to load snapshot twice, as it's materialized
Contributor
Author
There was a problem hiding this comment.
I've reverted it.
This was intended to be a poor-man's limit 1 because .snapshot() is normally lazy, etc.
Contributor
Author
There was a problem hiding this comment.
Pfft. And I just noticed the method isn't actually called from anywhere (including tests). So I'm just going to nuke it entirely.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
This PR:
.cleanup()implementation in favour of the.reset()method already available on the base class..load_for_all().snapshot()as an interface (onCrawlerBase) that all crawlers need to support.Linked issues
Progresses #2074, by laying the ground for crawlers to support refreshing.
Note that this PR and #2392 have a behaviour conflict that will trigger a failure in
test_runtime_crawl_permissionsif either is merged: resolving this is trivial.Functionality
assessmentTests