-
Notifications
You must be signed in to change notification settings - Fork 0
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
Refactor mosaic tile fetching and caching logic; improve CPU core det… #85
Refactor mosaic tile fetching and caching logic; improve CPU core det… #85
Conversation
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the WalkthroughThe changes involve significant updates to the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Mosaic
participant Fetcher
User->>Mosaic: Request tile
Mosaic->>Mosaic: Check zoom level
Mosaic->>Mosaic: Validate tile extension
Mosaic->>Fetcher: Fetch tile
Fetcher->>Mosaic: Return tile
Mosaic->>User: Provide tile
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
📒 Files selected for processing (2)
src/mosaic.mjs
(11 hunks)src/titiler_fetcher.mjs
(2 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
src/titiler_fetcher.mjs
[error] 6-6: Use Number.parseInt instead of the equivalent global.
ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.parseInt instead.
(lint/style/useNumberNamespace)
src/mosaic.mjs
[error] 237-237: This let declares a variable that is only assigned once.
'finalTiles' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 263-263: Use Number.POSITIVE_INFINITY instead of the equivalent global.
ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.POSITIVE_INFINITY instead.
(lint/style/useNumberNamespace)
🔇 Additional comments (2)
src/mosaic.mjs (1)
46-48
: Ensure cache functions handle null values correctly
When a tile doesn't intersect with the image footprint, null
is cached using cachePutTile(null, ...)
. Please verify that cacheGetTile
and cachePutTile
can correctly handle and distinguish between a cached null
value and a cache miss to prevent potential errors or unintended behavior.
src/titiler_fetcher.mjs (1)
50-50
: Re-evaluate the priority logic in tile request queue
Changing the priority calculation from Math.pow(2, z)
to z
alters how tile fetching requests are prioritized. Previously, higher zoom levels had exponentially higher priority, ensuring detailed tiles were fetched sooner. With linear priority, this behavior changes. Please verify that this adjustment aligns with the intended tile fetching strategy and does not negatively impact performance or user experience.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
⛔ Files ignored due to path filters (5)
__tests__/mosaic@1x-15-18970-11220.png
is excluded by!**/*.png
,!**/*.png
__tests__/mosaic@2x-11-1233-637.png
is excluded by!**/*.png
,!**/*.png
__tests__/mosaic@2x-12-2371-1402.png
is excluded by!**/*.png
,!**/*.png
__tests__/mosaic@2x-13-4742-2805.png
is excluded by!**/*.png
,!**/*.png
__tests__/mosaic@2x-14-9485-5610.png
is excluded by!**/*.png
,!**/*.png
📒 Files selected for processing (4)
__tests__/mosaic.mjs
(1 hunks)__tests__/mosaic512px.mjs
(1 hunks)src/mosaic.mjs
(6 hunks)src/mosaic_cache_invalidation_job.mjs
(1 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
src/mosaic.mjs
[error] 245-245: This let declares a variable that is only assigned once.
'finalTiles' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 257-257: Use Number.POSITIVE_INFINITY instead of the equivalent global.
ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.POSITIVE_INFINITY instead.
(lint/style/useNumberNamespace)
__tests__/mosaic512px.mjs
[error] 2-2: A Node.js builtin module should be imported with the node: protocol.
Using the node: protocol is more explicit and signals that the imported module belongs to Node.js.
Unsafe fix: Add the node: protocol.
(lint/style/useNodejsImportProtocol)
[error] 3-3: A Node.js builtin module should be imported with the node: protocol.
Using the node: protocol is more explicit and signals that the imported module belongs to Node.js.
Unsafe fix: Add the node: protocol.
(lint/style/useNodejsImportProtocol)
[error] 25-25: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
🔇 Additional comments (3)
src/mosaic.mjs (2)
245-245
: Use 'const' instead of 'let' for variables that are not reassigned
The variable finalTiles
is declared with let
but is never reassigned. To enhance code readability and prevent accidental reassignment, consider using const
instead.
Apply this diff to fix the issue:
-let finalTiles = mapTilesWithMetadata(rowTiles, resolvedRowTiles, metadataByUuid);
+const finalTiles = mapTilesWithMetadata(rowTiles, resolvedRowTiles, metadataByUuid);
🧰 Tools
🪛 Biome (1.9.4)
[error] 245-245: This let declares a variable that is only assigned once.
'finalTiles' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
257-257
: Use 'Number.POSITIVE_INFINITY' instead of 'Infinity'
For consistency with ES2015 standards, replace the global Infinity
with Number.POSITIVE_INFINITY
.
Apply this diff to fix the issue:
- gsd: Infinity,
+ gsd: Number.POSITIVE_INFINITY,
🧰 Tools
🪛 Biome (1.9.4)
[error] 257-257: Use Number.POSITIVE_INFINITY instead of the equivalent global.
ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.POSITIVE_INFINITY instead.
(lint/style/useNumberNamespace)
__tests__/mosaic.mjs (1)
145-145
: Test is now active, ensure test coverage and correctness
Activating the previously skipped test increases test coverage. Please verify that the test passes consistently and covers all expected scenarios.
…ection
https://kontur.fibery.io/Tasks/Task/OpenAerialMap-mosaic-prod-performance-issues-20341
Summary by CodeRabbit
New Features
cachedMosaic256px
andcachedMosaic512px
).Improvements
Refactor