Reputation: 3311
My Rails app starts a Sidekiq worker that only sends text messages. I am sure it doesn't need whole Rails env to work (it takes only client's phone and text to send as params). But currently the worker loads it and thus grabs a lot of memory from my tiny DigitalOcean droplet (as like separate Rails application).
Is there any way to tell the worker path to the only file it should require?
Upvotes: 4
Views: 910
Reputation: 15967
You can completely decouple your sidekiq worker to be standalone (one or two files) and run that as a separate process on your digital ocean instance. Then in your rails app when you're ready for work to be done you'd just push a job into redis:
Sidekiq::Client.push({
'class' => TextMessageWorker,
'queue' => queue_name,
'args' => [number, message]
})
There are obvious limitations to that (no scheduling AFAIK) but that should meet your needs for this small example.
Upvotes: 3