开发者

Are Resque queues created by the main thread or workers?

I'm a little confused because I hadn't set up any workers (on Heroku) and when I did Resque.enqueue the job was added to the queue (but not completed) so I'm assuming the main thread generated the queue.

Since I'm using Redis To Go, wouldn't this defeat the purpose of using a background process like Resque since Redis To Go is itself an external hosted database so the initial write process by the main thread开发者_开发问答 to add the job to the queue could be unpredictable?


What happens when you call Resque.enqueue is that Resque connects to the Redis database, and adds the information needed to call the job later. The worker then connects to Redis, pops off the first added job, does that, and repeats.

So yes, the "main" thread does connect to Redis. The fact that it's an external database doesn't really matter. I mean, for people using the Mongo database addons, the Mongo database is also externally hosted. The idea is that the job you want to execute takes longer than the time it takes to add it to Redis.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜