Repository navigation
Keep chat status updates going after the starting request ends - #180
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Chat status messages stopped moving past "Starting" after #179.
#179 also moved the effect snapshot forward on
eff-698-cloudflare-cluster. In that snapshot the Cloudflare entity runtime runs handlers through RpcServer, and RpcServer gives each request its ownScope, closed when the handler returns. Before, handlers saw the entity's scope. Alchemy's Postgres layer keeps one pool perScopein context, and aneffect/Poolwhose scope is closed answers everygetwith an interrupt.The session entity forks a turn into
entityScopefrom theReceivehandler, but the forked fiber still carried that request'sScope. OnceReceivereturned, every Postgres query from the turn was interrupted. The status watcher reads the kill switch on each tick.ChatKillSwitch.getcatches failures but not interrupts, so the first tick killed the watcher and the status stayed at "Starting".saveIndexlogged and went on, which is why production'schat_sessionsrows still sayrunningfor turns that have replied.This adds
forkInEntityinChat/Session.ts: it forks into the entity scope and also provides that scope as the fiber'sScope, as handlers had before. It replaces all fourforkIn(..., entityScope)calls.The new test in
Session.test.tsuses a kill switch that interrupts once the caller's scope is closed, the way the production pool does. It fails without the fix ("Timed out waiting for a Working status") and passes with it.PullRequestReview/RunEntity.tsalso forks into its entity scope. I haven't checked whether any of that work queries Postgres after its request ends.Closes EFF-3451