Skip to content

Instantly share code, notes, and snippets.

View DCrow's full-sized avatar
:electron:
Working as always

Yaroslav Barkovskiy DCrow

:electron:
Working as always
View GitHub Profile
@DCrow
DCrow / device_driver.cpp
Last active March 29, 2017 16:29
How to wrap a C struct in a ruby extension
#include "ruby.h"
// http://www.angelfire.com/electronic2/issac/rb_cpp_ext_tut.txt
typedef VALUE (ruby_method)(...);
VALUE DeviceDriver = Qnil;
struct conn {
VALUE settings;
connection *conn_ptr;
};
@DCrow
DCrow / dump_backtrace.rb
Last active July 11, 2018 14:24
Sidekiq cli threads
# Sidekiq process structure
# 1 main thread https://github.com/mperham/sidekiq/blob/master/lib/sidekiq/cli.rb#L104
# 1 heartbeat thread https://github.com/mperham/sidekiq/blob/master/lib/sidekiq/launcher.rb#L23
# 1 scheduled thread https://github.com/mperham/sidekiq/blob/master/lib/sidekiq/scheduled.rb#L63
# options[:concurency] manager threads https://github.com/mperham/sidekiq/blob/master/lib/sidekiq/manager.rb#L44
# If using sidekiq-scheduler gem
# 1 rufus scheduler thread https://github.com/jmettraux/rufus-scheduler/blob/master/lib/rufus/scheduler.rb#L537
# Some arbitrary number up to :max_work_threads https://github.com/jmettraux/rufus-scheduler/blob/master/lib/rufus/scheduler/jobs.rb#L332