Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rvkvino's avatar

Jobs are not getting execute some times in lumen API

I have a class to monitor the stock market rates with user request rates. I have written logic to compare both and while match the condition I need to send notification to end user and also I need to update this status in cloud site. My class looks like below,

public function update_client_executed_alerts($executed_clients_rates= array())
    {
        Log::info('Rate alert execution job creation.', [$executed_clients_rates]);
        $alertrequest = new RateAlertExecutedJob();
        $alertrequest->sendexecutedrates($executed_clients_rates);
               dispatch($alertrequest);
    }

And I have a job class like below,

class RateAlertExecutedJob implements ShouldQueue
{
    use InteractsWithQueue, Queueable, SerializesModels;
    protected $executedrates;

    public function __construct()
    {}
    public function sendexecutedrates($clientexecutedrates){
        $this->executedrates = $clientexecutedrates;
    }
    public function handle()
    {
        $executealerts = new PushExecutedratealerts();
        $executealerts->pushRates($this->executedrates);
    }
}

And calling one class to execute and send the notification and update in cloud site as like below,

class PushExecutedratealerts
{
public function pushRates($executed_alerts)
    {
        foreach($executed_alerts as $key => $executedrates){
            $client_details = json_decode(app('redis')->get("WLclient-" . $key), true);
            foreach($executedrates as $exkey => $val){
                //Here I have used one signal api curl to send push notification
            }
            Log::info("Update Queues URL: ".$execute_url); // This curl is used to update the status in cloud site api to update in cloud db.
            $field_string = http_build_query($executedrates);
            $handle = curl_init($execute_url);
            curl_setopt($handle, CURLOPT_POST, true);
            curl_setopt($handle, CURLOPT_POSTFIELDS, $field_string);
            curl_setopt($handle, CURLOPT_ENCODING,  '');
            $res = curl_exec($handle);
            curl_close($handle);
            Log::info("Cloud Site Return Value" . $res);
        }
    }
}

But this some times happening like notification and cloud site update both are working , in some times only notification only receiving cloud site api not getting trigger.

What I'm thinking if some other update happens in another class to send jobs to queue means it getting reject the previous queue. Could you please any one help me on this.

0 likes
0 replies

Please or to participate in this conversation.