Commit graph

48 commits

Author SHA1 Message Date
99245034ea Allow passing custom channels to fiberize
This allows customising the behevaiour, for example by using a queue.
2025-02-19 12:46:51 +00:00
ca3d5a1781 Fix handling of client-loop exceptions
Maybe other things can go wrong here, so log so that there's some
information available.
2025-02-19 12:44:47 +00:00
d597b77fcb Use the thread-pool record for the default timeout
Rather than a parameter.
2025-02-10 15:16:37 +00:00
6c083bdebd Use default io waiters in the thread pool
To allow creating thread pools from fibers.
2025-02-10 15:13:30 +00:00
ee2a93fbca Avoid needlessly setting the encoding 2025-02-07 17:02:37 +00:00
cb2085b684 Make more web server encoding tweaks 2025-02-07 16:09:42 +00:00
b0bb65dbed Tweak some web server exception handling 2025-02-07 10:54:59 +00:00
19c1fe235b Allow customising the web server read request exception handler 2025-02-07 10:48:50 +00:00
025449ea0d Remove the fiberize show-backtrace? option
This is no longer relevant now that the stack is added to the compound
exception.
2025-02-07 10:43:24 +00:00
b0d8618705 Fix exception handling for fibers-batch-map 2025-02-06 17:02:54 +00:00
7de5901a94 Simplify exception handling in the web server 2025-02-06 16:45:22 +00:00
6337103525 Remove the resource pool reply timeout
By being smarter about how long to wait for replies.
2025-02-04 13:16:38 +00:00
a11cd24e57 Improve resource pool performance when there are lots of waiters 2025-02-04 13:16:10 +00:00
aadbee0d0e Improve handling of idle resources in the resource pool 2025-02-04 11:13:15 +00:00
893299ba24 Start trying to improve exceptions and backtraces
When using knots utilities.
2025-02-03 15:44:51 +00:00
bddc6c04ad Fix idle resource removal in the resource pool 2025-02-03 12:16:16 +01:00
a2ab770536 Tweak resource pool backtraces 2025-02-03 12:16:07 +01:00
92bb4b8d85 Export the default-exception-handler 2025-02-03 12:06:10 +01:00
41974a6817 Rework handling of using a proc for the web server response body
To address encoding issues and improve exception handling.
2025-02-03 11:25:11 +01:00
40cf026ea4 Rework exception handling in the web server 2025-02-03 11:19:52 +01:00
dc98ef9dcc Improve exception reporting in the resource pool 2025-02-03 10:37:45 +01:00
823cd95628 Guard against the remove message not working 2025-02-03 09:55:57 +01:00
2910e66150 Fix issue with parallel creating resource pool resources 2025-02-02 11:29:25 +01:00
61451907a9 Improve resource pool destruction 2025-01-31 12:33:50 +01:00
eebb42e7a7 Default to an resource-pool add-resources-parallelism of 1
So that there aren't issues with concurrent resource addition, at
least by default.
2025-01-30 09:57:14 +01:00
c641c19ce4 Call web server exception handlers with the request
So that this can be used when reporting the exception.
2025-01-29 16:18:15 +00:00
b5cc5fd077 Make the web server buffer size configurable 2025-01-29 16:17:56 +00:00
c90cc88da7 Add fibers-promise-result-available? 2025-01-29 16:16:35 +00:00
c1796f0081 Update run-knots-web-server docstring 2025-01-25 18:17:38 +00:00
675d8c3258 Make the web server exception handler configurable 2025-01-25 18:16:27 +00:00
8805265243 Don't wait indefinitely for new requests in the web server
Inspired by the similar changes in Cuirass.
2025-01-25 18:16:27 +00:00
d2ee45581b Export the wait-until-port operations 2025-01-23 19:48:39 +01:00
8a99f51bf9 Handle when the wrong number of values is returned in the web server 2025-01-23 19:46:43 +01:00
42d885c553 Try to better handle exceptions in the web server 2025-01-23 09:34:54 +01:00
d572f591a3 Rename worker threads to thread pool
I think this needs more work, maybe the thread pool should be more
similar to the resource pool, but I think the name change is still
helpful.

Maybe there's a need for a variable size thread pool and that can
better integrate with the work queue.
2025-01-14 10:05:06 +00:00
dcb56ee2c5 Tweak the resource pool
Mostly to no longer sleep in the main fiber. Now the main fiber just
spawns other fibers when it would previously block on put-operation
and these other fibers communicate back to the main resource pool
fiber when necessary.

This should mean that the resource pool is more responsive.
2025-01-09 09:34:11 +00:00
59c183b13f Add fiberize
Not sure about the name yet, but this is useful.
2025-01-08 15:57:15 +00:00
409fa1df5c Allow customising the resource-pool put-message timeout 2025-01-08 12:23:18 +00:00
66e0c52bf4 Export resource-pool-name 2025-01-08 12:23:08 +00:00
0771a41fe0 Print resource pools without the channel
Since the channel printer prints quite a lot of text.
2025-01-06 19:22:50 +00:00
97a3116b81 Support getting the pool from the timeout error 2025-01-06 19:06:28 +00:00
6119ece5cb Enable the Makefile to run tests 2024-12-29 10:47:54 +00:00
7e55db0de7 Consistently use non-blocking 2024-12-29 10:45:31 +00:00
4e564b4814 Allow nesting worker thread calls
Incorporating changes from the nar-herder.
2024-12-28 10:44:12 +00:00
4e791aff68 Fix a bug in fibers-batch-map (and related procedures)
And add more tests.
2024-12-27 22:14:51 +00:00
e8ab6f23d8 Add call-with-sigint 2024-12-25 20:35:40 +00:00
dc2fe732ea Make the parallel operations more continuous
Instead of batching the list items, change the batch size to a
parallelism limit and run up to that many fibers. When the processing
of one list item finishes, another will then start immediately after,
rather than when the whole batch is finished.

These changes also make the fibers-map and fibers-for-each operations
work with vectors as well as lists.
2024-12-22 12:24:49 +00:00
2f39c58d6c Initial commit 2024-12-16 09:18:12 +00:00