Skip to content

docs(reply): cleanup and update to clarify elapsedTime behaviour#5728

Merged
mcollina merged 1 commit into
fastify:mainfrom
erkaperka:docs-reply-cleanup
Oct 7, 2024
Merged

docs(reply): cleanup and update to clarify elapsedTime behaviour#5728
mcollina merged 1 commit into
fastify:mainfrom
erkaperka:docs-reply-cleanup

Conversation

@erkaperka

Copy link
Copy Markdown
Contributor

Minor cleanup of Reply docs: Removed incorrect information stating that the elapsedTime getter will return 0 unless called in the onResponse hook, which is not the intended behaviour based on the discussion in #4575 and existing tests. I also removed a link that previously led to the getResponseTime section of the docs before it was removed in v5.

Checklist

Cheers!

…to removed getResponseTime method

- Remove incorrect information stating that `elapsedTime` may return zero unless called in the `onResponse` hook.
- Remove link to the `.getResponseTime()` method, which was completely removed in version 5.0.0.
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Oct 4, 2024

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@mcollina mcollina merged commit 38289e1 into fastify:main Oct 7, 2024
@davidsmith-accesso

davidsmith-accesso commented Nov 22, 2024

Copy link
Copy Markdown

@climba03003 @mcollina
Although reply.elapsedTime works outside of onResponse, it only returns a non-zero value if an onResponse handler exists:
https://github.com/fastify/fastify/blob/main/lib/route.js#L480
https://github.com/fastify/fastify/blob/main/lib/reply.js#L807

This should be clarified in the documentation or (I think better) made to work without the requirement of onResponse

@github-actions

Copy link
Copy Markdown

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Nov 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants