Skip to content

Comments

Add improved gRPC ecommerce example#3

Draft
swistaczek wants to merge 1 commit intomainfrom
98pbdp-codex/draft-e-commerce-liquid-page-with-caching-and-parallel-data-
Draft

Add improved gRPC ecommerce example#3
swistaczek wants to merge 1 commit intomainfrom
98pbdp-codex/draft-e-commerce-liquid-page-with-caching-and-parallel-data-

Conversation

@swistaczek
Copy link

Summary

  • refine gRPC product page example
  • use thread-safe caching with TTL
  • document async fetch and caching

Testing

  • bundle exec rake
  • bundle exec rubocop example/grpc_ecommerce/product_page.rb

Copy link

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.

Pull Request Overview

This pull request refines the gRPC product page example by introducing a thread‐safe caching mechanism with TTL, refining asynchronous data fetching with Concurrent::Promises, and updating documentation.

  • Introduces a Liquid template for rendering product pages
  • Implements concurrent data fetching with a thread-safe cache in product_page.rb
  • Updates the README to document the new example

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
example/grpc_ecommerce/templates/product_page.liquid Adds a new HTML template for the product page
example/grpc_ecommerce/product_page.rb Implements async gRPC fetches and caching logic
example/grpc_ecommerce/README.md Documents the updated gRPC ecommerce example


DemoProduct = Struct.new(:name, :description, :price, keyword_init: true)
DemoCategory = Struct.new(:name, keyword_init: true)
ProductRequest = Struct.new(:id)
Copy link

Copilot AI May 20, 2025

Choose a reason for hiding this comment

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

Consider adding keyword_init: true to the ProductRequest struct definition to support the keyword argument usage in 'ProductRequest.new(id: id)'.

Copilot uses AI. Check for mistakes.
DemoCategory = Struct.new(:name, keyword_init: true)
ProductRequest = Struct.new(:id)
Empty = Struct.new(:dummy)
RecommendationsRequest = Struct.new(:product_id)
Copy link

Copilot AI May 20, 2025

Choose a reason for hiding this comment

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

Consider adding keyword_init: true to the RecommendationsRequest struct to allow keyword argument construction with 'RecommendationsRequest.new(product_id: id)'.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant