Skip to content

Conversation

@joshthoward
Copy link
Contributor

…m invocations

Summary

Screenshots (optional)

Documentation checklist

  • The documentation style guide has been adhered to.
  • If a larger change - such as adding a new page- an issue has been opened in relation to any incorrect or out of date information that this PR fixes.
  • Files which have changed name or location have been allocated redirects.

@hyperlint-ai
Copy link
Contributor

hyperlint-ai bot commented May 28, 2025

Howdy and thanks for contributing to our repo. The Cloudflare team reviews new, external PRs within two (2) weeks. If it's been two weeks or longer without any movement, please tag the PR Assignees in a comment.

We review internal PRs within 1 week. If it's something urgent or has been sitting without a comment, start a thread in the Developer Docs space internally.


PR Change Summary

Updated the Durable Objects TTL example to clarify the correct implementation of Time To Live (TTL) and prevent infinite alarm invocations.

  • Clarified the implementation of TTL in Durable Objects to avoid infinite alarm invocations.
  • Added a caution note regarding the use of the constructor for extending TTL.
  • Updated comments in the code to reflect the correct behavior of TTL extension.

Modified Files

  • src/content/docs/durable-objects/examples/durable-object-ttl.mdx

How can I customize these reviews?

Check out the Hyperlint AI Reviewer docs for more information on how to customize the review.

If you just want to ignore it on this PR, you can add the hyperlint-ignore label to the PR. Future changes won't trigger a Hyperlint review.

Note specifically for link checks, we only check the first 30 links in a file and we cache the results for several hours (for instance, if you just added a page, you might experience this). Our recommendation is to add hyperlint-ignore to the PR to ignore the link check for this PR.

@github-actions github-actions bot added product:durable-objects Durable Objects: https://developers.cloudflare.com/workers/learning/using-durable-objects/ size/s labels May 28, 2025
@github-actions
Copy link
Contributor

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
/src/content/docs/durable-objects/ @elithrar, @vy-ton, @joshthoward, @oxyjun, @harshil1712, @cloudflare/pcx-technical-writing

@github-actions
Copy link
Contributor

github-actions bot commented May 28, 2025


A common feature request for Durable Objects is a Time To Live (TTL) for Durable Object instances. Durable Objects give developers the tools to implement a custom TTL in only a few lines of code. This example demonstrates how to implement a TTL making use of <GlossaryTooltip term="alarm">`alarms`</GlossaryTooltip>. While this TTL will be extended upon every new request to the Durable Object, this can be customized based on a particular use case.

:::caution[Not available in local development]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does the title say not available in local dev?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think alarm support in local dev is limited/non-existent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a copy/paste error. Thank you for catching @vy-ton.

@vy-ton
Copy link
Contributor

vy-ton commented May 28, 2025

@Oxyjun as a separate task, can we also enhance the alarm docs with:

  • warns against calling .setAlarm() in the constructor, at least without checking that the alarm is not already set
  • clarify recommendation is because if DO is inactive then the constructor is invoked before the alarm handler. So if the constructor code calls setAlarm, then it could interfere with the already configured next alarm

@Oxyjun
Copy link
Contributor

Oxyjun commented May 29, 2025

@Oxyjun as a separate task, can we also enhance the alarm docs with:

  • warns against calling .setAlarm() in the constructor, at least without checking that the alarm is not already set
  • clarify recommendation is because if DO is inactive then the constructor is invoked before the alarm handler. So if the constructor code calls setAlarm, then it could interfere with the already configured next alarm

Tracking this here: #22746

@joshthoward
Copy link
Contributor Author

This PR is replaced by #22761 because of the new security rules for our GitHub account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product:durable-objects Durable Objects: https://developers.cloudflare.com/workers/learning/using-durable-objects/ size/s

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants