mirror of
https://github.com/floci-io/floci.git
synced 2026-11-26 23:29:28 -05:00
perf: replace guessed runtime readiness waits (#7375)
Replace remaining guessed poller readiness delays with observable server state. Make extension polls request-specific and synchronize quiesce races through a no-op stopped-dispatch observation hook, failing explicitly on interruption. Retain main's dispatch-recovery and shutdown cleanup tests unchanged after #7380, including its dispatch-context exactly-once barrier. Validated 106 focused tests and Checkstyle.
This commit is contained in:
1 parent
5c303afac6
commit
8d9d74084d
2 files changed
+108
-52
No files matched your search
+14
-1
@@ -180,6 +180,12 @@ public class RuntimeApiServer {
|
||||
*/
|
||||
protected void beforeNextPathDispatchGuard() { }
|
||||
|
||||
/**
|
||||
* Test-only: signals that a stopped guard suppressed a runtime dispatch or INVOKE fan-out.
|
||||
* May run under the server lock, so overrides must not block.
|
||||
*/
|
||||
protected void onStoppedDispatchSkipped() { }
|
||||
|
||||
/**
|
||||
* Test-only: called inside quiesce() immediately after the lock has been
|
||||
* released, before any outside-lock work runs. Test subclasses override
|
||||
@@ -447,6 +453,8 @@ public class RuntimeApiServer {
|
||||
}
|
||||
if (!alreadyHandled) {
|
||||
sendInvocation(ctx, toDispatch);
|
||||
} else {
|
||||
onStoppedDispatchSkipped();
|
||||
}
|
||||
}
|
||||
// else: parked — enqueue() or the httpServer close will dispatch/end this ctx.
|
||||
@@ -807,7 +815,11 @@ public class RuntimeApiServer {
|
||||
private void notifyExtensionsOfInvoke(PendingInvocation invocation) {
|
||||
List<Runnable> dispatches = new ArrayList<>();
|
||||
synchronized (lock) {
|
||||
if (stopped || extensions.isEmpty()) {
|
||||
if (stopped) {
|
||||
onStoppedDispatchSkipped();
|
||||
return;
|
||||
}
|
||||
if (extensions.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
ExtensionEvent event = ExtensionEvent.invoke(
|
||||
@@ -897,6 +909,7 @@ public class RuntimeApiServer {
|
||||
boolean shouldDispatch;
|
||||
synchronized (lock) {
|
||||
if (stopped) {
|
||||
onStoppedDispatchSkipped();
|
||||
return;
|
||||
}
|
||||
if (waitingCtx.response().ended()) {
|
||||
|
||||
Reference in new issue
Block a user