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

minigun

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minigun

  • 0.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Minigun go BRRR

Minigun is a lightweight framework for rapid-fire batch job processing using a Producer-Accumulator-Consumer pattern. Minigun uses forking and threads to maximize system resource utilization.

In many use cases, Minigun can replace queue systems like Resque, Solid Queue, or Sidekiq. Minigun itself is run entire in Ruby's memory, and is database and application agnostic.

Enough talk, show me the code!

Here is a trivial proof-of-concept--Minigun can do a lot more than this!

require 'minigun'

class NewsletterSender
  include Minigun::Runner

  max_threads 10
  max_consumer_forks 5

  def initialize(start_time: Time.now - 1.day)
    @start_time = start_time
  end

  producer do
    # fix this
    User.where("created_at >= ?", @start_time)
        .not.where()
        .each do |user|
      produce(user)
    end
  end
  
  consumer do |user|
    NewsletterMailer.my_newsletter(user).deliver_now
    user.update(newsletter_sent_at: Time.now)
  end
end

# Run the Minigun job
NewsletterSender.new.go_brrr!


Use cases for Minigun include:
- Send a large number of emails to users in a target audience.


## Installation

```cmd
gem install minigun

Special Thanks

Alex Nicholson for the original idea for Minigun.

FAQs

Package last updated on 27 Sep 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