Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/GoogleCloudPlatform/microservices-demo/src/productcatalogservice

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/GoogleCloudPlatform/microservices-demo/src/productcatalogservice

  • v0.0.0-20241202204101-b9b6c11fe427
  • Source
  • Go
  • Socket score

Version published
Created
Source

productcatalogservice

Run the following command to restore dependencies to vendor/ directory:

go mod vendor

Dynamic catalog reloading / artificial delay

This service has a "dynamic catalog reloading" feature that is purposefully not well implemented. The goal of this feature is to allow you to modify the products.json file and have the changes be picked up without having to restart the service.

However, this feature is bugged: the catalog is actually reloaded on each request, introducing a noticeable delay in the frontend. This delay will also show up in profiling tools: the parseCatalog function will take more than 80% of the CPU time.

You can trigger this feature (and the delay) by sending a USR1 signal and remove it (if needed) by sending a USR2 signal:

# Trigger bug
kubectl exec \
    $(kubectl get pods -l app=productcatalogservice -o jsonpath='{.items[0].metadata.name}') \
    -c server -- kill -USR1 1
# Remove bug
kubectl exec \
    $(kubectl get pods -l app=productcatalogservice -o jsonpath='{.items[0].metadata.name}') \
    -c server -- kill -USR2 1

Latency injection

This service has an EXTRA_LATENCY environment variable. This will inject a sleep for the specified time.Duration on every call to to the server.

For example, use EXTRA_LATENCY="5.5s" to sleep for 5.5 seconds on every request.

FAQs

Package last updated on 02 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc