我正在使用 Redis 通过队列提交作业。我的问题是我需要能够判断队列或 redis 是否仍在工作。我需要通知用户 redis 正在处理我发送给他的队列,或者我需要通知客户端我还没有完成
谢谢
工作
public function handle()
{
Redis::throttle('vote')->allow(2)->every(1)->then(function ()
{
DB::beginTransaction();
try
{
$this->candidate->votos = (int)$this->candidate->votos + (int) $this->value_vote;
$this->candidate->save();
$this->userevent->voto = 1;
$this->userevent->vote_date = Carbon::now();
$this->userevent->save();
DB::commit();
} catch (\ValidationException $e) {
//\Log::error("fail");
DB::rollback();
} catch (\Exception $e) {
//\Log::error("fail2");
DB::rollback();
}
}, function () {
return $this->release(2);
});
}
并在控制器中执行
$result = vote::dispatch($candidate, $ue);