pict-rs/releases/0.4.2.md
2023-08-05 16:49:14 -05:00

2.6 KiB

pict-rs 0.4.2

Overview

I'm happy to announc pict-rs 0.4.2 today. This is a smaller release but includes some important changes. A few users had been seeing issues around pict-rs' HTTP client when talking to object storage or downloading media, this release should fix these issues.

Features

Bugfix

Changes

Upgrade Notes

There's no significant changes from 0.4.1, so upgrading should be as simple as pulling a new version of pict-rs.

Descriptions

Process Timeout

pict-rs spawns processes to handle identifying and processing images. These processes have not had many bounds in place so far, and are left to run more or less unattended for as long as they care to take. This can cause problems when a large file is uploaded and causes clients to time out while waiting. While the proper solution for these cases is to use the backgrounded endpoint to avoid timing out http requests when processing large files, It may be worth limiting the duration these processes are allowed to run for.

0.4.2 introduces a new config option: PICTRS__MEDIA__PROCESS_TIMEOUT, which governs how long any given process that pict-rs spawns is allowed to run. The default value here is 30 seconds, but on systems with slower CPUs or if larger files need to be handled, this value can be increased. Alternatively, if only small or simple files need to be hosted, then this value can be lowered, ensuring any file that is too complex will not be succesfully processed.

When an operation times out, this is considered a client error, since the client initiated a request with a file too complex to process in a reasonable amount of time.

Dangling Backgrounded Uploads

In some cases, a backgrounded upload could fail and leave the original unprocessed media in the store, but inaccessible from any client. This is now solved by ensuring that even when processing a backgrounded upload fails, the source files are cleaned before the job completes.

Reqwest

This release swaps the awc HTTP client library for reqwest. Due to a number of HTTP-related issues, and awc's status as a less-supported member of the actix-web ecosystem, pict-rs has moved to reqwest for making HTTP requests. This should result in slightly better performance, fewer dangling connections, and fewer connection errors.

The PICTRS__SERVER__CLIENT_POOL_SIZE variable is now less useful. Since reqwest doesn't give control of its pool size directly, this value now limits simultaneous idle connections to a given host.