尊龙凯时人生就是搏

LaravelÖÐ×÷·ÏÐÐÁÐʹÃüµÄ¼¸ÖÖ·½·¨

ÔÚ laravel ÖУ¬ÐÐÁУ¨queue£©ÊÇÒ»ÖÖ¸ßЧµÄÖÎÀíÒ첽ʹÃüµÄ·½·¨¡£Í¨¹ýÐÐÁУ¬ÎÒÃÇ¿ÉÒÔ½«Ò»Ð©ºÄʱµÄʹÃü·Åµ½ºǫ́´¦Àí£¬´Ó¶øÌá¸ßϵͳµÄÐÔÄܺÍÎȹÌÐÔ¡£È»¶ø£¬ÔÚÏÖʵµÄ¿ª·¢ÖУ¬ÎÒÃÇÓÐʱ¼äÒ²ÐèÒª×÷·ÏÐÐÁÐÖеÄʹÃü¡£±¾ÎĽ«»áÏÈÈÝ laravel ÖÐ×÷·ÏÐÐÁÐʹÃüµÄ¼¸ÖÖ·½·¨ºÍ×¢ÖØÊÂÏî¡£

×÷·ÏÐÐÁÐʹÃüµÄ·½·¨

ɾ³ýÐÐÁÐÖеÄʹÃü

ÎÒÃÇ¿ÉÒÔͨ¹ýÔÚ¿ØÖÆ̨»òÕß´úÂëÖÐÊÖ¶¯É¾³ýÐÐÁÐÖеÄʹÃüÀ´µÖ´ï×÷·ÏʹÃüµÄЧ¹û¡£

ÔÚ¿ØÖÆ̨ÖУ¬ÎÒÃÇ¿ÉÒÔʹÓÃÒÔÏÂÏÂÁ

php artisan queue:failed

php artisan queue:forget {id}

ÆäÖУ¬queue:failed ÏÂÁî»áÁгöËùÓÐʧ°ÜµÄʹÃü£¬°üÀ¨ËüÃÇµÄ id ºÍʧ°ÜÔµ¹ÊÔ­ÓÉ¡£queue:forget ÏÂÁî¿ÉÒÔƾ֤¸ø¶¨µÄ id ×÷·ÏÖ¸¶¨µÄʹÃü¡£¿ÉÊÇ£¬ÕâÖÖ·½·¨Ö»ÊÊÓÃÓÚÐÐÁÐÖеÄʧ°ÜʹÃü¡£

ÔÚ´úÂëÖУ¬ÎÒÃÇ¿ÉÒÔʹÓà Queue µÄ deleteFailedJob ÒªÁìÀ´É¾³ýʧ°ÜµÄʹÃü£¬»òÕßʹÓà Redis µÄ DEL ÏÂÁîɾ³ýÕýÔÚÖ´ÐеÄʹÃü¡£

Å׳öÒì³£

ÔÚ Laravel ÖУ¬ÎÒÃÇ¿ÉÒÔͨ¹ýÅ׳öÒì³£À´×÷·ÏʹÃüµÄÖ´ÐС£µ±ÐÐÁд¦ÀíÆ÷ÔÚÖ´ÐÐʹÃüʱ£¬ÈôÊÇÓöµ½Òì³££¬»á×Ô¶¯½«Ê¹Ãü±ê¼ÇΪʧ°ÜʹÃü£¬²¢ÇÒ»áÔÚÐÐÁÐÈÕÖ¾Öмͼ¹ýʧÐÅÏ¢¡£ÎªÁËÈÃÒì³£±»´¦ÀíÆ÷²¶»ñ£¬ÎÒÃÇÐèÒªÔÚʹÃüÖаü×°Ò»¸ö try-catch ´úÂë¿é¡£ÒÔÏÂÊÇÒ»¸ö¼òÆÓµÄʾÀý£º

namespace App\Jobs;

use Exception;

use Illuminate\Bus\Queueable;

use Illuminate\Contracts\Queue\ShouldQueue;

use Illuminate\Foundation\Bus\Dispatchable;

use Illuminate\Queue\InteractsWithQueue;

use Illuminate\Queue\SerializesModels;

class MyJob implements ShouldQueue

{

use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

public function handle()
{
    try {
        // Ê¹ÃüÖ´ÐдúÂë
    } catch (Exception $e) {
        // Å׳öÒì³££¬×÷·ÏʹÃü
        throw new Exception('ʹÃüÒÑ×÷·Ï');
    }
}

µÇ¼ºó¸´ÖÆ

}

ʹÓó¬Ê±»úÖÆ

ÔÚ Laravel ÖУ¬ÎÒÃÇ¿ÉÒÔÉèÖÃÐÐÁÐʹÃüµÄ³¬Ê±Ê±¼ä¡£ÈôÊÇÒ»¸öʹÃüÔÚ»®¶¨µÄʱ¼äÄÚûÓÐÍê³É£¬´¦ÀíÆ÷»á×Ô¶¯½«Æä±ê¼ÇΪʧ°ÜʹÃü¡£ÎÒÃÇ¿ÉÒÔʹÓÃÕâ¸ö»úÖÆÀ´×÷·ÏÕýÔÚÖ´ÐеÄʹÃü¡£ÒÔÏÂÊÇÒ»¸ö¼òÆÓµÄʾÀý£º

namespace App\Jobs;

use Illuminate\Bus\Queueable;

use Illuminate\Contracts\Queue\ShouldQueue;

use Illuminate\Foundation\Bus\Dispatchable;

use Illuminate\Queue\InteractsWithQueue;

use Illuminate\Queue\SerializesModels;

class MyJob implements ShouldQueue

{

use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

public $timeout = 10; // ÉèÖó¬Ê±Ê±¼äΪ 10 Ãë

public function handle()
{
    // Ê¹ÃüÖ´ÐдúÂë
}

µÇ¼ºó¸´ÖÆ

}

×¢ÖØÊÂÏî

ʹÓÃÑÓ³ÙʹÃüʱҪСÐÄ£¬²»¿É¼òÆÓµØʹÓà Queue µÄ delete ÒªÁìɾ³ýʹÃü¡£ÓÉÓÚÑÓ³ÙʹÃüµÄ ID ÊÇƾ֤ʱ¼ä´ÁÌìÉúµÄ£¬É¾³ýʹÃüºóÔÙÖØÐÂÕë¶ÔͳһÌõʹÃüÌí¼ÓеÄÑÓʱ²Ù×÷ʱ£¬ID »á±¬·¢×ª±ä£¬´ËʱÏ൱ÓÚÌí¼ÓÁËÒ»ÌõеÄʹÃü¡£

ËùÓеÄʹÃü¶¼Ó¦¸ÃÉèÖó¬Ê±Ê±¼ä£¬²»È»¿ÉÄÜ»áÓÉÓÚʹÃüÖ´ÐÐʱ¼ä¹ý³¤¶øµ¼ÖÂÐÔÄÜÎÊÌâ¡£

µ±Å׳öÒì³£×÷·ÏʹÃüʱ£¬Òª×¢ÖØÒì³£µÄÄÚÈÝ£¬ÒÔ±ÜÃâÔÚʹÃü´¦ÀíÆ÷·ºÆð¹ýʧʱй¶¹ý¶àµÄÐÅÏ¢¡£

ʹÓÃÒÔÉÏÈκÎÒ»ÖÖ·½·¨×÷·ÏÐÐÁÐʹÃüʱ£¬¶¼Ó¦¸ÃÔÚ cancel ÊÂÎñÖмͼÊÂÎñÈÕÖ¾£¬ÒÔ±ãÒÔºóµÄά»¤ºÍµ÷ÊÔ¡£

±¾ÎÄÏÈÈÝÁË Laravel ÖÐ×÷·ÏÐÐÁÐʹÃüµÄ¼¸ÖÖ·½·¨ºÍ×¢ÖØÊÂÏî¡£µ±ÎÒÃDz»Ï£Íûij¸öʹÃü±»Ö´ÐÐʱ£¬¿ÉÒÔʹÓÃÒÔÉÏ·½·¨×÷·ÏËü¡£Í¬Ê±£¬ÎÒÃÇҪƾ֤ÏÖʵµÄÐèÇóºÍÇéÐÎÑ¡ÔñºÏÊʵķ½·¨À´×÷·ÏʹÃü£¬ÒÔ±ã°ü¹ÜϵͳµÄÎȹÌÐÔºÍÐÔÄÜ¡£

ÒÔÉϾÍÊÇLaravelÖÐ×÷·ÏÐÐÁÐʹÃüµÄ¼¸ÖÖ·½·¨µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是搏ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是搏ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是搏

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ