Suggestions for images processing

I’m getting familiar with the platform and stumbled upon the following use case. I sync publications that might contain images. For each image, I need to get the original dimensions and generate a placeholder. Each sync request (triggered by user) might include a single publication or many of them.

Currently, my solution works like this. When a user triggers sync, I route the request to a durable object, which manages the synchronizations for each user (object ID is derived from a user ID). It splits the workload into tasks - one task is one publication - and dispatches each task to its own queue.

Within the queue, I load publication data from external API and collect image URLs.
For each image, I do the following:

  • Download the original image, primarily to get its dimensions. I didn’t find any API to get this data via Cloudflare.
  • Upload to Cloudflare Images
  • Generate a placeholder from the resized source either by resizing the original image in memory or downloading the image version from Cloudflare Images.
  • Collect the resulting image struct for storing in D1.

When all images are processed, I insert publication and images into D1.

This was the plan, but even with placeholder generation disabled, which is relatively intense, a queue dies on a publication with like 15+ images.

Since I am just starting with the platform, maybe I abuse tools. So, I want to ask for suggestions on how to handle this case properly on Cloudflare.

Some more context:

  • I haven’t deployed this code yet. The issue I described is on my local machine.
  • The worker is fully written in Rust with worker-rs.
  • [email protected]
  • I set usage_model = "unbound" in wrangler.toml but it did not make a difference.