尊龙凯时人生就是搏

laravelÔõôÐÞ¸ÄÑÓʱÐÐÁÐ

½üÄêÀ´£¬laravel¿ò¼ÜÔ½À´Ô½ÊܽӴý£¬ÆäÖÐÑÓʱÐÐÁÐÊÇËüµÄÖ÷Òª¹¦Ð§Ö®Ò»¡£ÑÓʱÐÐÁÐÄܹ»×ÊÖú¿ª·¢ÕßÇáËÉÖÎÀíÒ첽ʹÃü£¬´ó´óÌá¸ßÓ¦ÓóÌÐòµÄÐÔÄܺͿÉά»¤ÐÔ¡£ÔÚһЩÌØÊâÇéÐÎÏ£¬ÎÒÃÇÐèÒªÐÞ¸ÄlaravelÑÓʱÐÐÁеÄһЩĬÈÏÖµ£¬ÒÔÖª×ãÏêϸÏîÄ¿µÄÐèÇó¡£±¾ÎĽ«ÏÈÈÝÔõÑùÐÞ¸ÄlaravelÑÓʱÐÐÁеIJÎÊý¡£

LaravelµÄÑÓʱÐÐÁÐÖ÷ÒªÊÇͨ¹ýRedis»òʹÓÃÊý¾Ý¿âʵÏֵġ£ÔÚLaravelÉèÖÃÎļþ£¨config/queue.php£©ÖУ¬ÎÒÃÇ¿ÉÒÔ¿´µ½ÐÐÁеÄĬÈÏÉèÖá£ÀýÈ磬Laravel¹ØÓÚÑÓʱÐÐÁеÄĬÈϳ¬Ê±Ê±¼äÊÇ60Ã루ĬÈÏÖµÔÚÊôÐÔtimeoutÖÐÉèÖã©£¬¹ØÓÚÖØÊÔ´ÎÊýµÄĬÈÏÉèÖÃÊÇ3´Î£¨Ä¬ÈÏÖµÔÚÊôÐÔtriesÖÐÉèÖã©¡£µ±Ê¹Ãü´¦Àí³¬Ê±»òÕß´¦Àíʧ°Üʱ£¬Laravel»á×Ô¶¯½«Ê¹ÃüÌí¼Óµ½ÏÂÒ»¸öÑÓʱÐÐÁÐÖУ¬²¢½µµÍʹÃüµÄÓÅÏȼ¶¡£ÎÒÃÇ¿ÉÒÔͨ¹ýÐÞ¸ÄĬÈÏÉèÖÃÀ´¸ü¸ÄÕâЩֵ£¬µ«Õⲿ·ÖÉèÖò¢²»ÊÊÓÃÓÚÒѾ­ÔÚÊÂÇéµÄÐÐÁС£Òò´Ë£¬ÎÒÃÇÐèÒªÔÚÐÐÁÐÔËÐÐʱ¾ÙÐÐÐ޸ġ£

Ê×ÏÈ£¬ÎÒÃÇÐèÒª·­¿ªÐÐÁмàÌýÆ÷£¨queue:work£©¡£ÔÚ·­¿ªÐÐÁмàÌýÆ÷ʱ£¬ÎÒÃÇÐèҪͨ¹ýartisanÏÂÁîÐÐÖ¸¶¨workerµÄÃû³Æ¡£ÀýÈ磬ʹÓÃcommand_name²ÎÊýÀ´ÎªworkerÃüÃû£¬ÈçÏÂËùʾ£º

php artisan queue:work --command_name=worker1

µÇ¼ºó¸´ÖÆ

workerµÄÃû³ÆĬÒÔΪ”default”¡£ÔÚÏÂÁîÐÐÖÐÖ¸¶¨workerÃû³ÆµÄÀûÒæÊÇ£¬ÎÒÃÇ¿ÉÒÔÔÚºóÐø´úÂëÖкÜÈÝÒ×µØʶ±ðworker¡£

½ÓÏÂÀ´£¬ÎÒÃÇÐèÒªÔÚÏîÄ¿ÖÐÌí¼ÓÒ»¸öеÄworkerÀà¡£ÎÒÃÇ¿ÉÒÔͨ¹ýÖ´ÐÐÒÔÏÂÏÂÁîÔÚapp/JobsĿ¼Ï½¨ÉèÒ»¸öеÄworkerÀࣺ

php artisan make:job MyCustomWorker

µÇ¼ºó¸´ÖÆ

È»ºó£¬ÎÒÃÇ¿ÉÒÔÔÚMyCustomWorkerÀàµÄhandleÒªÁìÖÐÌí¼Ó×Ô½ç˵Âß¼­¡£ÀýÈ磬ÈôÊÇÎÒÃÇÏ뽫ÑÓʱʱ¼ä´ÓĬÈϵÄ60Ãë¸ÄΪ120Ã룬ÎÒÃÇ¿ÉÒÔÔÚhandleÒªÁìÖÐÌí¼ÓÒÔÏ´úÂ룺

public function handle()
{
    $this->delay(120);
    // your custom code goes here
}

µÇ¼ºó¸´ÖÆ

Õâ¸ödelayÒªÁ콫ÐÞ¸ÄʹÃüµÄÑÓʱʱ¼äΪ120Ã룬ÒÔÁýÕÖĬÈÏÑÓ³Ù¡£handleÒªÁìÖеÄÆäËû´úÂ뽫ÔÚÖ¸¶¨ÑÓ³ÙºóÖ´ÐС£

ÎÒÃÇÒ²¿ÉÒÔÔÚworkerÀàÖÐÐÞ¸ÄʹÃüµÄÖØÊÔ´ÎÊý¡£ÀýÈ磬ÈôÊÇÎÒÃÇÏ뽫ÖØÊÔ´ÎÊý´ÓĬÈϵÄ3´Î¸ÄΪ5´Î£¬ÎÒÃÇ¿ÉÒÔÔÚMyCustomWorkerÀàÖÐÌí¼ÓÒÔÏ´úÂ룺

public function handle()
{
    $this->tries(5);
    // your custom code goes here
}

µÇ¼ºó¸´ÖÆ

Õâ¸ötriesÒªÁ콫ÐÞ¸ÄʹÃüµÄÖØÊÔ´ÎÊýΪ5´Î£¬ÒÔÁýÕÖĬÈÏÖØÊÔ´ÎÊý¡£handleÒªÁìÖеÄÆäËû´úÂ뽫ÔÚʹÃüʧ°Üºó×Ô¶¯ÖØÊÔÖ¸¶¨µÄ´ÎÊý¡£

ͨ¹ýÒÔÉÏ°ì·¨£¬ÎÒÃǾͿÉÒÔÔÚLaravelÏîÄ¿ÖÐÐÞ¸ÄÑÓʱÐÐÁеÄһЩĬÈϲÎÊý¡£ÕâÖÖÒªÁì¿ÉÒÔ×ÊÖúÎÒÃÇƾ֤ÏêϸÏîÄ¿µÄÐèÇ󣬶¨ÖÆ»¯µØÖÎÀíÒ첽ʹÃü£¬ÒÔÌá¸ßÓ¦ÓóÌÐòµÄÐÔÄܺͿÉά»¤ÐÔ¡£

ÒÔÉϾÍÊÇlaravelÔõôÐÞ¸ÄÑÓʱÐÐÁеÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

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