Skip to content

Repository files navigation

Rate Limiter Project

This project implements a rate-limited Notification Service using Ruby on Rails, Redis for rate limiting, and PostgreSQL as the database. It ensures that recipients are not overwhelmed with too many email notifications of various types.

Table of Contents

Requirements

  • Ruby 3.1.0
  • Rails 7.0
  • PostgreSQL
  • Redis
  • Bundler

Setup

  • Clone the repository:
    git clone https://github.com/yourusername/notification_rate_limiter.git
  • Install dependencies:
    bundle install
  • Setup the database:
    rails db:create
    rails db:migrate
  • Start the Redis server:
    redis-server
  • Run the Rails server:
    rails server

Running Tests

To run the RSpec tests, use the following command:

rspec

Impletation Details

Notification Service

The NotificationService is responsible for sending email notifications. It ensures that the rate limits are respected for each type of notification.

Rate Limiter Service

The RateLimiter class handles the logic for enforcing rate limits using Redis.

Notification Types and Rate Limits

  • Status: Not more than 2 notifications per minute per recipient.
  • News: Not more than 1 notification per day per recipient.
  • Marketing: Not more than 3 notifications per hour per recipient.

Contributing

Feel free to open issues or submit pull requests for any improvements or bug fixes.

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages