Skip to content

Instantly share code, notes, and snippets.

View danielnc's full-sized avatar

Daniel Naves de Carvalho danielnc

View GitHub Profile
class Jobs::PatientsJob
include Sidekiq::Worker
def perform(name)
Patient.create(first_name: name, provider: Provider.order(:id).first, user: Provider.order(:id).first.users.first)
puts Patient.count
puts Provider.order("id desc").last.patients.count
end
end
^C2016-08-24T19:04:13.959Z 45813 TID-ovq1ck45c INFO: Shutting down
2016-08-24T19:04:13.959Z 45813 TID-ovq1ck45c INFO: Terminating quiet workers
2016-08-24T19:04:13.959Z 45813 TID-ovq27tw6s INFO: Scheduler exiting...
2016-08-24T19:04:13.960Z 45813 TID-ovq2au8t0 INFO: Leader stepping down
2016-08-24T19:04:14.060Z 45813 TID-ovq1ck45c INFO: Pausing to allow workers to finish...
2016-08-24T19:04:21.893Z 45813 TID-ovq1ck45c WARN: Terminating 25 busy worker threads
2016-08-24T19:04:21.894Z 45813 TID-ovq1ck45c WARN: Work still in progress [#<struct Sidekiq::Pro::TimedFetch::UnitOfWork queue="queue:default", job="{\"class\":\"Jobs::PatientsJob\",\"args\":[\"a\"],\"retry\":true,\"queue\":\"default\",\"backtrace\":true,\"jid\":\"1ea1a16c0b4898a5bd67bece\",\"created_at\":1472058670.974536,\"enqueued_at\":1472058670.974584}">, #<struct Sidekiq::Pro::TimedFetch::UnitOfWork queue="queue:default", job="{\"class\":\"Jobs::PatientsJob\",\"args\":[\"a\"],\"retry\":true,\"queue\":\"default\",\"backtrace\":true,\"jid\":\"205d9
@danielnc
danielnc / gist:14bd6099197a5aa8e0f390cc2c476516
Created August 24, 2016 19:04
sidekiq -ttin stuck threads
2016-08-24T19:03:01.868Z 45813 TID-ovq1ck45c WARN: Thread TID-ovq1ck45c
2016-08-24T19:03:01.869Z 45813 TID-ovq1ck45c WARN: /Users/user/.rbenv/versions/2.2.4/gemsets/project-v1.1/gems/sidekiq-4.1.3/lib/sidekiq/cli.rb:144:in `backtrace'
/Users/user/.rbenv/versions/2.2.4/gemsets/project-v1.1/gems/sidekiq-4.1.3/lib/sidekiq/cli.rb:144:in `block in handle_signal'
/Users/user/.rbenv/versions/2.2.4/gemsets/project-v1.1/gems/sidekiq-4.1.3/lib/sidekiq/cli.rb:141:in `each'
/Users/user/.rbenv/versions/2.2.4/gemsets/project-v1.1/gems/sidekiq-4.1.3/lib/sidekiq/cli.rb:141:in `handle_signal'
/Users/user/.rbenv/versions/2.2.4/gemsets/project-v1.1/gems/sidekiq-4.1.3/lib/sidekiq/cli.rb:93:in `run'
/Users/user/.rbenv/versions/2.2.4/gemsets/project-v1.1/gems/sidekiq-ent-1.3.2/lib/sidekiq-ent/swarm.rb:150:in `block in forkit'
/Users/user/.rbenv/versions/2.2.4/gemsets/project-v1.1/gems/sidekiq-ent-1.3.2/lib/sidekiq-ent/swarm.rb:146:in `fork'
/Users/user/.rbenv/versions/2.2.4/gemsets/project-v1.1/gems/sidekiq-ent-1.3.2/lib/sidekiq-e
Thread 32 (Thread 0x3703 of process 79215):
#0 0x00007fff8dcf6db6 in __psynch_cvwait () from /usr/lib/system/libsystem_kernel.dylib
#1 0x00007fff8b419728 in _pthread_cond_wait () from /usr/lib/system/libsystem_pthread.dylib
#2 0x00000001088c425f in rb_mutex_lock ()
#3 0x00000001088b7ee3 in vm_call_cfunc ()
#4 0x000000010889c7c9 in vm_exec_core ()
#5 0x00000001088ab6d6 in vm_exec ()
#6 0x00000001088b442e in vm_call0_body ()
#7 0x00000001088b3d82 in rb_call0 ()
[databases]
dev_master = host=127.0.0.1 port=5432 dbname=caremessage_dev_master pool_size=1 timezone=UTC client_encoding=UNICODE
[pgbouncer]
listen_addr = 127.0.0.1
listen_port = 6432
auth_type = trust
auth_file = /etc/pgbouncer/userlist.txt
logfile = /var/log/pgbouncer/pgbouncer.log
pidfile = /var/run/pgbouncer/pgbouncer.pid
pool_mode = transaction
Thread 32 (Thread 0x3703 of process 40990):
#0 0x00007fff94b87db6 in __psynch_cvwait () from /usr/lib/system/libsystem_kernel.dylib
#1 0x00007fff98cab728 in _pthread_cond_wait () from /usr/lib/system/libsystem_pthread.dylib
#2 0x0000000102dbd5b3 in gvl_acquire_common ()
#3 0x0000000102db7471 in rb_thread_call_without_gvl ()
#4 0x00000001031feda1 in rsock_ipaddr () from /Users/user/.rbenv/versions/2.2.4/lib/ruby/2.2.0/x86_64-darwin15/socket.bundle
#5 0x00000001031f5c4a in sock_s_getaddrinfo () from /Users/user/.rbenv/versions/2.2.4/lib/ruby/2.2.0/x86_64-darwin15/socket.bundle
#6 0x0000000102dadee3 in vm_call_cfunc ()
#7 0x0000000102d927c9 in vm_exec_core ()
source "https://rubygems.org"
ruby "2.2.4"
gem "puma"
gem "rails", "3.2.22.2"
gem "jquery-rails", "2.1.3"
gem "jquery-ui-rails"
gem "devise", "~> 3.0.0"
gem "devise_security_extension", git: "https://github.com/phatworx/devise_security_extension"
gem "url_formatter"
@danielnc
danielnc / audible_library_export_markdown.js
Last active August 29, 2015 14:23
Audible export library markdown
"|Book Cover|URL|\n|:-----|----|" + _.map(_.sortBy($('.adbl-lib-content tbody tr td[name=titleInfo] a[name=tdTitle]:visible'), function(elem) {
return elem.innerText
}), function(elem) {
img = $(elem).parent().siblings("td[name='productCover']").find("img").attr("src")
return "|" + ['![alt tag](', img, ')'].join('') + "|" + [elem.innerText, '](', elem.href, ')'].join('') + "|";
}).join('\n')