github gofr-dev/gofr v1.52.0

23 hours ago

Release v1.52.0

🚀 Features

🔹 Redis PubSub Support

GoFr now supports Redis PubSub as a messaging backend, providing seamless integration with Redis for publish-subscribe patterns in microservices.

  • Supports both Redis Channels (traditional PubSub) and Redis Streams modes
  • Configurable via REDIS_PUBSUB_MODE environment variable (defaults to streams)
  • Redis Streams features:
    • Consumer groups for load balancing and message distribution
    • Automatic consumer group creation with MKSTREAM support
    • Configurable PEL (Pending Entry List) ratio for balancing pending vs new messages (default: 0.7, i.e., 70% PEL, 30% new messages)
    • Stream length management with MaxLen configuration
    • Automatic message acknowledgment handling
  • Redis Channels features:
    • Traditional PubSub channel support for simple messaging patterns
    • Automatic channel creation on first publish/subscribe
  • Separate database support via REDIS_PUBSUB_DB to prevent keyspace collisions (defaults to database 15)
  • Configurable buffer size, query timeout, and query limits
  • Automatic connection monitoring and resubscription on reconnection
  • Full observability with metrics, logging, and distributed tracing
  • Graceful error handling with permanent failure detection

🚀 Enhancements

🔹 HTTP Router Path Normalization

Router now normalizes paths before routing to handle edge cases with double slashes and malformed paths.

  • Automatically cleans and normalizes request paths using path.Clean()
  • Handles empty paths, double slashes, and trailing slashes consistently
  • Ensures proper routing behavior regardless of path formatting in requests
  • Improves compatibility with various HTTP clients and reverse proxies

🛠️ Fixes

🔹 JSON Encoding Error Handling for NaN Values

Fixed a bug where math.NaN() values in responses caused incorrect error handling. The responder now properly handles JSON encoding failures by:

  • Detecting encoding errors before writing response headers
  • Returning appropriate 500 Internal Server Error status code for encoding failures

🔹 Grafana Dashboard Configuration

Fixed Grafana dashboard configuration to ensure proper metrics visualization and monitoring capabilities.

Don't miss a new gofr release

NewReleases is sending notifications on new releases.