Skip to content

pganalyze/sidekiq_server.rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sidekiq Server Build Status Crates.io Crates.io Crates.io

Sidekiq is a simple and efficient background processing library for Ruby. This repository provieds a sidekiq compatible server in rust, which behaves totally the same as vanilla in terms of sidekiq's dashboard.

The basic idea is that, since ruby is slow, we write job handlers in rust with native code. So we write job definitions and enqueue jobs in ruby, while implementations and done jobs are written in rust.

Snapshots:

dashboard

tui

Usage:

  1. Implementing your own JobHandler
  2. Instantiate a server and insert your own job handlers
  3. Set up dummy jobs with same name as your job handlers in ruby
  4. Run sidekiq_server and submit jobs from ruby

You can see examples/main.rs for building a Sidekiq server, and see codes in ruby/ to get an idea on writing dummy tasks in ruby.

Advanced usage:

You can definitely embed a ruby VM in your job handlers, running ruby codes when the job is not a native job, so that it soon becomes a complete sidekiq server with additional native code support.

Terminate the server:

sidekiq_server currently recognizes 2 types of UNIX signals:

  • SIGINT For forcing the server to exit. The server will terminate all workers and exit in exactly certain time. The default time is 10 seconds.

  • SIGUSR1 For gracefully exiting the server. The server will inform workers and wait them to quit.

Server will not accept anymore jobs if receives either of the above signals.

TODO:

  • Sidekiq dashboard capability.
  • Exit signal handling.
  • Support arbitrary fields in job object.
  • Middleware support.
  • Job retry support via middleware.
  • Documentation.
  • Unique job support via middleware.
  • Ruby code handler
  • Regex handler matching.

About

A Sidekiq server implemented in Rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published