DEV Community

Advert4
Advert4

Posted on

Building Advert4: safer retries for social publishing

Social publishing has a tricky failure mode: a request times out after the network has already created the post. Retrying the same request can produce a duplicate.

In Advert4, our Laravel publishing service separates a scheduled post from each network's publishing target. Each target records its own state and remote post ID. Before sending a create request, the service records that publishing has started. A network error after that point is treated as an uncertain result rather than a safe instruction to publish again.

For Mastodon, we also attach a stable idempotency key. Media uploads are tracked separately so processing checks do not upload the same file again.

The practical lesson: distinguish a definite rejection from an unknown outcome. Automatic retries are useful for some read operations and rate limits; a timed-out create request needs more care.

We are building Advert4 at Electroinvest in Podgorica, Montenegro, and will share implementation notes as integrations are verified.

Disclosure: this article was prepared with AI assistance.

Top comments (0)