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

Add Tokio #102

Merged
merged 10 commits into from
Dec 30, 2021
Merged

Add Tokio #102

merged 10 commits into from
Dec 30, 2021

Conversation

arctic-hen7
Copy link
Member

Right now, Perseus doesn't do async well at all. There are some blocking I/O operations deep in the core, and any libraries that people want to pull into their builders that require a full runtime like Tokio will not work at all, because everything comes down to a futures::executor::block_on at present.

This PR solves that issue by bringing in Tokio at the top level and making all core operations (particularly in the stores and translations manager systems) fully asynchronous. This should allow using more complex libraries and code in builder functions, and should also enable potentially large performance gains for apps that build many pages from a single template (as that is now all done in parallel). Additionally, this makes the Perseus server far more resilient and logical.

Astoundingly, none of this actually constitutes a breaking change, though plugin developers will have to ensure that their systems are Sendable (which shouldn't pose a problem for most, and there's only one publicly available plugin in existence at present).

All plugin functions must now implement `Send`.
Magical compilation errors occur otherwise for some reason.
This should increase performance for templates with a very large number
of pages, each generated path is now built concurrently.
I *think* this makes everything async, the main thing is just the file operations.
@arctic-hen7 arctic-hen7 added C-enhancement Category: enhancement C-performance Category: performance A-templates Area: templates P-high Priority: high S-in-development Status: in development A-plugins Area: plugins system labels Dec 30, 2021
@arctic-hen7 arctic-hen7 self-assigned this Dec 30, 2021
Actix seems to introduce a breaking change in the deps tree on CI,
though this hasn't been reported anywhere else. If people start having
issues, I'll release an urgent patch.
This should hopefully fix the consistent breakages of `apt` on CI.
@arctic-hen7 arctic-hen7 merged commit 150fda8 into main Dec 30, 2021
@arctic-hen7 arctic-hen7 deleted the feat-async-runtime branch December 30, 2021 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-plugins Area: plugins system A-templates Area: templates C-enhancement Category: enhancement C-performance Category: performance P-high Priority: high S-in-development Status: in development
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant