Skip to content

refactor: make App.prototype.handler() sync#2906

Merged
marvinhagemeister merged 2 commits into
freshframework:mainfrom
timreichen:make-app-handler-sync
May 12, 2025
Merged

refactor: make App.prototype.handler() sync#2906
marvinhagemeister merged 2 commits into
freshframework:mainfrom
timreichen:make-app-handler-sync

Conversation

@timreichen

Copy link
Copy Markdown
Contributor

No description provided.

@marvinhagemeister marvinhagemeister left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The underlying buildCache.fromSnapshot() function is still async. By making app.handler() sync, this PR introduces a race condition where a request might be coming in before the snapshot is restored. In this case we go through the error handling logic and will show an error.

For production servers this is not an acceptable way to handle client traffic.

@timreichen

Copy link
Copy Markdown
Contributor Author

The underlying buildCache.fromSnapshot() function is still async. By making app.handler() sync, this PR introduces a race condition where a request might be coming in before the snapshot is restored. In this case we go through the error handling logic and will show an error.

For production servers this is not an acceptable way to handle client traffic.

This PR also makes fromSnapshot() sync. Or are there more async calls that I missed?

@marvinhagemeister

Copy link
Copy Markdown
Contributor

This PR also makes fromSnapshot() sync. Or are there more async calls that I missed?

Oh apologies, I missed that in the changes. In that case it makes sense.

@marvinhagemeister marvinhagemeister left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@marvinhagemeister marvinhagemeister merged commit 1cfb4bc into freshframework:main May 12, 2025
4 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants