当前位置: 动力学知识库 > 问答 > 编程问答 >

sidekiq - How to queue rails calls so function isn't run in parallel

问题描述:

I have some rails code that calls model1.func1(). A controller action calls this, where multiple people can be hitting it, as does a scheduled rake task. I want to make sure that model1.func1() cannot be called in parallel. If another thread needs to call at the same time, it should wait for model1.func() to finish. I guess I want to queue these calls. I was going to use sidekiq for this, but with only one worker. I read on a forum that

Sidekiq is not appropriate for the serial job and I don't want to make

it appropriate. Different tools are useful for different reasons,

jack of all trades master of none, etc.

What do you guys recommend instead?

网友答案:

I would consider beanstalkd with one worker process.

分享给朋友:
您可能感兴趣的文章:
随机阅读: