Download the PHP package bjornbasar/karhu-queue without Composer

On this page you can find all versions of the php package bjornbasar/karhu-queue. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package karhu-queue

karhu-queue

Minimal queue/worker abstraction for the karhu PHP microframework.

Install

Push jobs

Process jobs

Schema

updated_at tracks the last status transition (v0.2.0+). push() relies on the INSERT default; pop(), complete(), and fail() each bump it. This is what unstick() keys off to detect stuck-in-processing rows.

complete() and fail() are guarded by WHERE id = :id AND status = 'processing' so a row that's already been reset (e.g. by unstick()) is never silently flipped to completed/failed by a stale handler.

Stuck-job recovery

When a worker is SIGKILL'd mid-job (OOM, host reboot, docker kill) the row stays in processing forever — Worker's try/catch only catches handler exceptions, not no-exception process death. QueueInterface::unstick() is the recovery path. Run it on a cron:

It returns the count of rows reset. The UPDATE's WHERE clause (status='processing' AND updated_at < cutoff) IS the dedup — a live worker that completes a row between the cron's snapshot and the UPDATE will have flipped status='completed', so the row simply no longer matches. No race window vs. a completing worker.

Callers MUST ensure handlers are idempotent. "Stuck" means "no status transition in N seconds", NOT "definitely dead". A slow live handler whose wall time exceeds the threshold WILL be unstuck and re-popped while still executing. Pick the threshold to safely exceed your slowest handler's wall time (5× safety factor recommended). Handler idempotency is the load-bearing contract that makes recovery safe.

Custom drivers

Implement QueueInterface for Redis, RabbitMQ, etc.

Concurrency

DatabaseQueue::pop() is atomic on PostgreSQL (9.5+) at the claim step. Two concurrent workers will never claim the same row: each worker's SELECT locks one pending row with FOR UPDATE SKIP LOCKED inside a transaction, and a second worker's SELECT skips the locked row and either claims the next pending one or returns null.

Driver detection is automatic (constructor reads PDO::ATTR_DRIVER_NAME); no caller change needed when moving from SQLite tests to PG production.

FIFO is best-effort: under sequence rollback or any other source of non-monotonic id, SKIP LOCKED does not re-evaluate ORDER BY id after the lock is taken, so a row with a smaller id inserted concurrently can be claimed after a row with a larger id. For typical use (monotonic SERIAL/AUTOINCREMENT, FIFO-by-insertion semantics) this is invisible.

Other drivers

Caller-owned transactions

pop() opens its own transaction only if PDO::inTransaction() is false. If you call pop() inside an outer transaction, the row lock is held by your outer txn and released on your commit/rollback — pop() will not commit or rollback the outer txn.


All versions of karhu-queue with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package bjornbasar/karhu-queue contains the following files

Loading the files please wait ...