Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: removes context on the C side #1404

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

AlliBalliBaba
Copy link
Collaborator

@AlliBalliBaba AlliBalliBaba commented Feb 22, 2025

Most of this PR is a refactor of the FrankenPHPContext. I noticed that having a context on both the C and the go side can be pretty confusing and error prone. Especially considering that fatal errors (like timeouts) will make a worker just jump to the end of a script. This PR removes most of the context on the C side and decouples some components from net/http by passing the context in channels.
Having minimal thread-local context on the C side should also make it easier to execute PHP directly in go threads in the future.

@AlliBalliBaba AlliBalliBaba changed the title Feat: adds busy timeouts refactor: removes contet on the C side Feb 23, 2025
@AlliBalliBaba AlliBalliBaba changed the title refactor: removes contet on the C side refactor: removes context on the C side Feb 23, 2025
@AlliBalliBaba AlliBalliBaba marked this pull request as ready for review February 23, 2025 23:35
caddy/caddy.go Outdated
@@ -63,6 +64,8 @@ type FrankenPHPApp struct {
Workers []workerConfig `json:"workers,omitempty"`
// Overwrites the default php ini configuration
PhpIni map[string]string `json:"php_ini,omitempty"`
// The maximum amount of time a request may be stalled wainting for threads
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
// The maximum amount of time a request may be stalled wainting for threads
// The maximum amount of time a request may be stalled waiting for threads

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I removed the 'busy timeout' and will put it into a separate PR. This PR now only refactors the context (smaller PRs are easier to review)

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.

3 participants