Fdawgs/docsmith

Use `onResponse`, `onTimeout` and `onRequestAbort` route hooks to clean up temp files

Fdawgs opened this issue · 1 comments

Prerequisites

  • I have written a descriptive title

  • I have searched existing feature requests to ensure it has not already been proposed

  • I agree to follow the Code of Conduct that this project adheres to

Description

Fastify v4.14.0 added the onRequestAbort hook, which runs when a client aborts a request.
At present the onSend hook is used as a workaround to handle client aborts, but blocks the response until the temp files are cleared.

Changing to onResponse, onTimeout and onRequestAbort route hooks will stop the blocking and improve response times.

Not a huge boost, onSend catches everything and glob can be moved to a stream to stop blocking