久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

      <bdo id='O6oyO'></bdo><ul id='O6oyO'></ul>

    1. <i id='O6oyO'><tr id='O6oyO'><dt id='O6oyO'><q id='O6oyO'><span id='O6oyO'><b id='O6oyO'><form id='O6oyO'><ins id='O6oyO'></ins><ul id='O6oyO'></ul><sub id='O6oyO'></sub></form><legend id='O6oyO'></legend><bdo id='O6oyO'><pre id='O6oyO'><center id='O6oyO'></center></pre></bdo></b><th id='O6oyO'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='O6oyO'><tfoot id='O6oyO'></tfoot><dl id='O6oyO'><fieldset id='O6oyO'></fieldset></dl></div>

      <small id='O6oyO'></small><noframes id='O6oyO'>

      <tfoot id='O6oyO'></tfoot>
    2. <legend id='O6oyO'><style id='O6oyO'><dir id='O6oyO'><q id='O6oyO'></q></dir></style></legend>

      在 Laravel 中取消作業

      Cancel Jobs In Laravel(在 Laravel 中取消作業)
        <bdo id='0WJkK'></bdo><ul id='0WJkK'></ul>

        • <legend id='0WJkK'><style id='0WJkK'><dir id='0WJkK'><q id='0WJkK'></q></dir></style></legend><tfoot id='0WJkK'></tfoot>
            <tbody id='0WJkK'></tbody>
            • <i id='0WJkK'><tr id='0WJkK'><dt id='0WJkK'><q id='0WJkK'><span id='0WJkK'><b id='0WJkK'><form id='0WJkK'><ins id='0WJkK'></ins><ul id='0WJkK'></ul><sub id='0WJkK'></sub></form><legend id='0WJkK'></legend><bdo id='0WJkK'><pre id='0WJkK'><center id='0WJkK'></center></pre></bdo></b><th id='0WJkK'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='0WJkK'><tfoot id='0WJkK'></tfoot><dl id='0WJkK'><fieldset id='0WJkK'></fieldset></dl></div>

                <small id='0WJkK'></small><noframes id='0WJkK'>

              1. 本文介紹了在 Laravel 中取消作業的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                如果我調用以下內容:

                return AdventureJob::dispatch($event->character->refresh(), $event->adventure, $event->levelsAtATime)->delay($timeTillFinished);
                

                這將創建一個延遲 x 分鐘的作業.我的作業都是通過redis處理的,有沒有辦法獲取這個特定的作業或者從隊列中刪除這個特定的作業?

                This will then create a job thats delayed x minutes. my jobs are all processed through redis, is there a way to then get this specific job or delete this specific job from the queue?

                人們談論 php artisan 命令然后刪除所有作業,這不是我想要的我想獲取有關此作業的某種信息(作業 ID?或隊列 ID?Redis ID?)然后存儲在數據庫中如果玩家然后取消冒險,我可以使用它在隊列中找到這個作業并刪除它,假設它沒有運行.

                People talk about php artisan commands to then delete all jobs, thats not what I want I want to get some kind of information (Job ID? or queue ID? Redis ID?) about this job to then store in the database so that if the player then cancels the adventure, I can use that to find this job on the queue and delete it, assuming it's not running.

                推薦答案

                沒有直接或簡單的方法來做到這一點.延遲的作業保存在 sorted set 中作為待處理時間作為 score 和作業負載作為 value.

                There is no direct or easy way to do it. The delayed jobs are kept in sorted sets as to-be-processed time as score and job payload as the value.

                有幾種方法可以從已排序的集合中移除元素(其中大多數需要一些努力,具體取決于延遲隊列的大小),例如

                There are several ways to remove an element from the sorted sets(most of them require some efforts depending on the size of the delayed queue) such as

                • 你得到了精確的"分派作業的有效負載,然后使用 ZREM 將其刪除.這很困難,因為對象(具有所有參數的作業的序列化版本)可能很大,而且您無法創建精確"的對象.工作,因為它有一個唯一的標識符.您可以使用 ZRANGEBYSCORE 和 WITHSCORES 獲取它的列表.它將為您提供帶有分數的工作列表.您可以使用分數來識別被延遲的工作.獲取值(序列化的有效負載)然后使用 ZREM.
                • 如果在特定時間只有一項作業要處理,您可以使用 ZREMRANGEBYSCORE使用處理時間.如果恰好在那個時間有 n 個作業要處理,那么其他作業也可以刪除,因為 ZREMRANGEBYSCORE 需要時間間隔.
                • 您可以嘗試使用 ZSCAN 掃描整個延遲列表(帶分頁)并找到作業的分數和標識符,然后使用帶有標識符的 ZREMRANGEBYLEX 將其刪除.
                • 另一種方法是在 handle 方法的開頭放置一個取消條件.這個需要應用層開發.每當您將作業推送到隊列時,您都會向作業發送一個標識符,在 Redis 中也放置相同的標識符(您可以理解)(EXPIRE 大于延遲時間).當你想取消它時,然后從Redis中刪除它.在 handle 方法內部檢查給定的標識符是否存在于 Redis 中,如果不存在則從代碼塊提前返回.
                • You get the "exact" payload of the dispatched job and then use ZREM to remove it. It is hard because the object(serialized version of the job with all the parameters) can be huge and you can't create the "exact" job because it has a unique identifier. You can get the list of it with ZRANGEBYSCORE and with WITHSCORES. It will give you the list of jobs with their scores. You can use score to identify to be delayed job. Get the value(serialized payload) then use ZREM.
                • If there is only one job to be processed at a specific time you, may use ZREMRANGEBYSCORE with using the processed time. If there are n jobs to be processed exactly that time then other jobs can be deleted too since ZREMRANGEBYSCORE takes time interval.
                • You may try to use ZSCAN to scan the whole delayed list(with pagination) and find the score and identifier of the job, and then use ZREMRANGEBYLEX with the identifier to remove it.
                • Another way could be putting a cancellation condition at the beginning of handle method. This one requires application layer development. Whenever you push a job to the queue you send an identifier to the job, put same identifier(that you can understand) in Redis too(with EXPIRE greater than the delayed time). When you want to cancel it, then delete it from the Redis. Inside the handle method check whether the given identifier exists in Redis, if not early return from the code block.

                這篇關于在 Laravel 中取消作業的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                PHP PDO ODBC connection(PHP PDO ODBC 連接)
                Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                MSSQL PDO could not find driver(MSSQL PDO 找不到驅動程序)
              2. <small id='JDAqB'></small><noframes id='JDAqB'>

                <legend id='JDAqB'><style id='JDAqB'><dir id='JDAqB'><q id='JDAqB'></q></dir></style></legend>

                  <tbody id='JDAqB'></tbody>

                  <i id='JDAqB'><tr id='JDAqB'><dt id='JDAqB'><q id='JDAqB'><span id='JDAqB'><b id='JDAqB'><form id='JDAqB'><ins id='JDAqB'></ins><ul id='JDAqB'></ul><sub id='JDAqB'></sub></form><legend id='JDAqB'></legend><bdo id='JDAqB'><pre id='JDAqB'><center id='JDAqB'></center></pre></bdo></b><th id='JDAqB'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='JDAqB'><tfoot id='JDAqB'></tfoot><dl id='JDAqB'><fieldset id='JDAqB'></fieldset></dl></div>

                      • <bdo id='JDAqB'></bdo><ul id='JDAqB'></ul>

                        <tfoot id='JDAqB'></tfoot>
                          主站蜘蛛池模板: 成人精品福利 | eeuss国产一区二区三区四区 | 毛片毛片毛片毛片 | 亚洲精品在线视频 | 欧美一区二区在线视频 | 波多野结衣精品 | 久视频在线观看 | 午夜伦理影院 | 成人免费观看男女羞羞视频 | 国产精品久久久久久久免费大片 | 国产成人福利在线观看 | 一区二区在线 | 国产乱码精品一区二区三区中文 | 操操操av | 欧美日韩精品一区二区三区蜜桃 | 久久久一二三区 | 一级黄色绿像片 | 国产91中文 | 欧美中文字幕一区 | 91av视频在线播放 | 欧洲妇女成人淫片aaa视频 | 一区二区三区av | 精品久久久久久久 | 国产精品久久二区 | 一区二区三区视频在线观看 | 中文字幕在线播放第一页 | 欧美日韩成人影院 | 精品毛片视频 | 久久国产高清视频 | 日本午夜免费福利视频 | 亚洲一区二区在线视频 | 国产综合久久久 | 天堂一区二区三区四区 | 国产乱码精品1区2区3区 | 久久久久九九九女人毛片 | 国产成人亚洲精品 | 成人在线 | 欧美人妇做爰xxxⅹ性高电影 | 久久久一区二区三区四区 | 99精品一区二区三区 | 欧美一区二区三区国产 |