GithubHelp home page GithubHelp logo

codeigniter4 / queue Goto Github PK

View Code? Open in Web Editor NEW
42.0 9.0 10.0 808 KB

Queues for the CodeIgniter 4 framework

Home Page: https://queue.codeigniter.com/

License: MIT License

PHP 99.84% Hack 0.16%
codeigniter codeigniter4 queue queue-workers php81

queue's Issues

by composer install error

[ErrorException]

Undefined array key 0

at VENDORPATH\codeigniter4\queue\src\Commands\QueuePublish.php:21

Bug: Queue Not Logging Failed Tasks with Transactions

Issue Description:
I have identified a bug in the CodeIgniter 4 queue system. When a task fails during execution, and that task involves a transaction, it fails to log the failure in the designated log file.

class ExampleJob
{
    public function process(string $data):
    {
        $db = db_connect();
        
        $db->transStart(); // Start Transaction
            
       // Job logic here and get RuntimeException

    }
}

When a job fails to execute, the system fails to log the failure in the queue_jobs_failed table. Furthermore, when utilizing the DatabaseHandler, the job record remains unremoved from the queue_jobs table.

This oversight results in a lack of visibility into failed jobs and may lead to potential data inconsistency within the job management system.

Dev: FOR UPDATE SKIP LOCKED issue when retrieving jobs in a queue

When retrieving jobs in a queue the function skipLocked() is called (QueueJobModel.php). The sql addon "FOR UPDATE SKIP LOCKED" is not available in new but not the newest MariaDB versions. This causes a "FALSE" on the query leading to an empty queue. Perhaps it's better to throw an exception than. Returning zero jobs is confusing.

FOR UPDATE SKIP LOCKED

MariaDb 10.5 not work query

SELECT *
FROM `queue_jobs`
WHERE `queue` = 'price_import'
AND `status` = 0
AND `available_at` <= 1707854930
AND `priority` IN ('default')
ORDER BY `available_at` ASC, `id` ASC
 LIMIT 1 FOR UPDATE SKIP LOCKED

queue:work default - error after start job

CodeIgniter\CLI\CLI::print(): Argument #1 ($text) must be of type string, int given, called in \vendor\codeigniter4\queue\src\Commands\QueueWork.php on line 164

at SYSTEMPATH\CLI\CLI.php:449

Backtrace:
1 VENDORPATH\codeigniter4\queue\src\Commands\QueueWork.php:164
CodeIgniter\CLI\CLI::print()

2 SYSTEMPATH\CLI\Commands.php:65
CodeIgniter\Queue\Commands\QueueWork()->run()

3 SYSTEMPATH\CLI\Console.php:46
CodeIgniter\CLI\Commands()->run()

4 ROOTPATH\spark:102
CodeIgniter\CLI\Console()->run()

No return type in Services::queue()

https://github.com/michalsn/codeigniter-queue/blob/2ff57f5858934e9385450b55fd821ca7aff4702e/src/Config/Services.php#L11

This causes the following PHPStan (phpstan-codeigniter) error.

 ------ --------------------------------------------- 
  Line   app/Events/NewPostEvent.php                  
 ------ --------------------------------------------- 
  66     Service method 'queue' returns mixed.        
         ๐Ÿ’ก Perhaps you forgot to add a return type?  
 ------ --------------------------------------------- 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.