Quantcast
Channel: Active questions tagged redis+ruby-on-rails - Stack Overflow
Viewing all articles
Browse latest Browse all 873

Redis, Sidekiq and Heroku Apps

$
0
0

I have two Rails Apps that need to share some state. Each App needs to run background jobs during their execution lifetimes. I added Heroku Redis to each App, and Sidekiq. So when I run background jobs, everything is great.

I do not have shared state until I point one App's REDIS_URL at the other Apps REDIS_URL and then both Apps are using the same shared Redis instance, I assume, and hence I have some shared state.

Now both Sidekiq instances share the same Redis, and one App is seeing the other Apps jobs and puking, because it has no idea about the other Apps jobs.

What is a clearer way of sharing state and keeping the jobs separate like they should be? I guess I need to just buy a cache I can use as shared state separate from the jobs?

Heroku App 1. Owns Redis Instance. Has Sidekiq. Runs Job AaaBbbJobHeroku App 2. Points at Redis Instance from App1. Has Sidekiq

I notice the logs for App 2 show job AaaBbbJob tried running and failed as AaaBbbJob was not found.

In the logs of App 1, Job AaaBbbJob ran fine...

So my confusion lies in trying to assure myself that this is all OK. When App 1 through a job via Sidekiq into Redis, for whatever reason, App 2 saw that job in Redis too, and tried to run it.

So my question is, since throwing Jobs into Redis is now shared between two Apps, they both try and run ANY jobs they see?


Viewing all articles
Browse latest Browse all 873

Trending Articles