Skip to content

Commit 5d969dc

Browse files
committed
[DOCS] Document async mode, --folder and async_throttle_ms
1 parent b5fadf2 commit 5d969dc

2 files changed

Lines changed: 51 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [Unreleased]
9+
10+
### Added
11+
12+
- Opt-in **async conversion mode** (`async = 1`): WebP conversions are queued in a new `tx_webp_queue` table and processed out-of-band by a TYPO3 Scheduler task. Closes [#17](https://github.com/plan2net/webp/issues/17).
13+
- New CLI command `webp:process-queue` with optional `--folder=PATH` argument to convert images in non-FAL folders (e.g., `typo3temp/assets/online_media/`). Closes [#73](https://github.com/plan2net/webp/issues/73).
14+
- New `async_throttle_ms` configuration to space conversions out with randomized jitter, preventing thundering-herd CPU/IO.
15+
816
## [14.0.0] - 2026-05-14
917

1018
### Added

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ After a `composer update`, **save the extension settings at least once** via *Ad
9595
| [`filter_pattern`](#filter_pattern) | `/\.(jpe?g\|png\|gif)\.webp$/i` | PCRE for which `.webp` to hide (only when `hide_webp`) |
9696
| [`exclude_directories`](#exclude_directories) | _(empty)_ | Skip processing for matching paths |
9797
| [`use_system_settings`](#use_system_settings) | `1` | Reuse GFX color profile settings (MagickConverter) |
98+
| [`async`](#async) | `0` | Queue conversions for a scheduler worker instead of running them on the page-render path |
99+
| [`async_throttle_ms`](#async_throttle_ms) | `0` | Random per-conversion sleep (ms) in the worker; 0 disables |
98100

99101
### `parameters`
100102

@@ -205,6 +207,47 @@ Applies only to `MagickConverter`. When enabled, the value of `$GLOBALS['TYPO3_C
205207

206208
`PhpGdConverter` and external-binary configurations ignore this flag.
207209

210+
### `async`
211+
212+
```
213+
# cat=async; type=boolean; label=Enable asynchronous conversion
214+
async = 0
215+
```
216+
217+
When enabled, the `AfterFileProcessing` listener writes a row to `tx_webp_queue` instead of running the converter inside the request. Conversions then happen out-of-band via the `webp:process-queue` CLI command, typically registered as a TYPO3 Scheduler task. See [Async mode](#async-mode) below for setup.
218+
219+
When disabled (default), conversions run synchronously exactly as before.
220+
221+
### `async_throttle_ms`
222+
223+
```
224+
# cat=async; type=int+; label=Random sleep (ms) between conversions
225+
async_throttle_ms = 0
226+
```
227+
228+
Pause for a random interval between conversions inside the worker. Value `0` means no pause. Value `N > 0` means each pause is `random(N/2, N*3/2)` milliseconds — modeled on `wget --random-wait` to avoid lock-step bursts. Useful on tight-CPU servers when a batch of conversions would otherwise saturate the box. Applies to both queue mode and `--folder` mode.
229+
230+
## Async mode
231+
232+
By default the extension converts images synchronously inside the request that processes the source file. On image-heavy pages or large-fileadmin sites this adds latency to every render. Enabling `async = 1` moves the conversion off the render path:
233+
234+
1. Set `async = 1` in the extension configuration.
235+
2. Run TYPO3's database analyzer so `tx_webp_queue` is created.
236+
3. Register a TYPO3 Scheduler task: **System → Scheduler → Add task → Type: "WebP: process conversion queue"**. Pick a frequency that matches your throughput (every minute for busy sites, hourly for low-traffic).
237+
4. Make sure the scheduler itself runs — either via `vendor/bin/typo3 scheduler:run` in cron, or a daemonized runner.
238+
239+
The listener will now enqueue new conversions; the scheduler task drains the queue in the background. Existing siblings stay; the extension does not retroactively backfill.
240+
241+
### Sweeping non-FAL folders
242+
243+
Some image folders (notably `typo3temp/assets/online_media/` for YouTube/Vimeo preview thumbnails) live outside TYPO3's File Abstraction Layer, so the listener never sees them. The `--folder` argument bypasses the queue and converts files directly:
244+
245+
```sh
246+
vendor/bin/typo3 webp:process-queue --folder=typo3temp/assets/online_media/
247+
```
248+
249+
Register this as a second Scheduler task ("Execute console command") if you want it to run periodically. Paths resolve relative to the public web root and are restricted to it for safety.
250+
208251
## Webserver configuration
209252

210253
The webserver inspects the client's `Accept` header and rewrites the request to the `.webp` sibling when both are true:

0 commit comments

Comments
 (0)