Liking cljdoc? Tell your friends :D

vaelii.browser.inflight

Page loads that run long: released from the request, joined rather than repeated, and listed while they run.

A page is a read, and over a KB of millions of sentexes some reads run for minutes or more. Without this, the request holds its server thread for the whole read and the reader gets a spinner. A reader who clicks again, or reloads, starts a second read of the same page beside the first. Neither read can be stopped from outside: interrupting a thread inside a disk store's read closes the store's file channel. So the protection is to never start a second copy of a read, and to show what is running.

  • Released. A page load runs on a thread of its own, and the request waits for it detach-ms (vaelii.browser.detach-ms, 5 s). A page done by then is answered as usual. One that is not is answered with a page saying what is being computed and for how long. That page polls /inflight/poll and, once the read is done, loads the page's own URL again, which is then answered from the finished result.
  • Joined. A second load of the same URL and query in the same session while the first runs waits on the first instead of starting another. The read always computes the whole document, never the boosted fragment, so a boosted load and a plain reload of the same URL share one read (htmx selects #main out of a whole document).
  • Kept. A finished result nobody was waiting for is kept keep-ms for that next load, then dropped.
  • Listed. running is what /jobs lists: each read's URL, its age, and the engine frame its thread is in.

Only a page load is guarded: a GET or HEAD that is a plain navigation or an htmx boosted one (HX-Boosted). Every other htmx request targets part of a page that has its own place to land, and a waiting page swapped into it would land in the wrong place. Static files (a last path segment holding a dot) and /health pass straight through.

Page loads that run long: released from the request, joined rather than repeated, and
listed while they run.

A page is a read, and over a KB of millions of sentexes some reads run for minutes or
more. Without this, the request holds its server thread for the whole read and the
reader gets a spinner. A reader who clicks again, or reloads, starts a second read of
the same page beside the first. Neither read can be stopped from outside: interrupting
a thread inside a disk store's read closes the store's file channel. So the protection
is to never start a second copy of a read, and to show what is running.

- **Released.** A page load runs on a thread of its own, and the request waits for it
  `detach-ms` (`vaelii.browser.detach-ms`, 5 s). A page done by then is answered as
  usual. One that is not is answered with a page saying what is being computed and for
  how long. That page polls `/inflight/poll` and, once the read is done, loads the
  page's own URL again, which is then answered from the finished result.
- **Joined.** A second load of the same URL and query in the same session while the
  first runs waits on the first instead of starting another. The read always computes
  the whole document, never the boosted fragment, so a boosted load and a plain reload
  of the same URL share one read (htmx selects `#main` out of a whole document).
- **Kept.** A finished result nobody was waiting for is kept `keep-ms` for that next
  load, then dropped.
- **Listed.** `running` is what `/jobs` lists: each read's URL, its age, and the
  engine frame its thread is in.

Only a **page load** is guarded: a GET or HEAD that is a plain navigation or an htmx
boosted one (`HX-Boosted`). Every other htmx request targets part of a page that has
its own place to land, and a waiting page swapped into it would land in the wrong
place. Static files (a last path segment holding a dot) and `/health` pass straight
through.
raw docstring

detach-msclj

(detach-ms)

How long a page load holds its request before it is answered with the waiting page: vaelii.browser.detach-ms when it parses to a positive integer, else 5 s.

How long a page load holds its request before it is answered with the waiting page:
`vaelii.browser.detach-ms` when it parses to a positive integer, else 5 s.
sourceraw docstring

hrefclj

(href {:keys [uri query]})

The URL of a read: its page's own.

The URL of a read: its page's own.
sourceraw docstring

keep-msclj

How long a finished result that nobody was waiting for is kept for the load that comes back for it.

How long a finished result that nobody was waiting for is kept for the load that comes
back for it.
sourceraw docstring

runningclj

(running)

The page reads running now, oldest first: {:id :uri :query :started :ms :frame}, where :frame is the innermost engine frame its thread is in.

The page reads running now, oldest first: `{:id :uri :query :started :ms :frame}`, where
`:frame` is the innermost engine frame its thread is in.
sourceraw docstring

statusclj

(status id)

:running, :done or nil (an id this process holds nothing for) for the read id.

`:running`, `:done` or nil (an id this process holds nothing for) for the read `id`.
sourceraw docstring

wrapclj

(wrap h waiting session-of)

Guard h's page loads (see the namespace doc). waiting renders the page a load past detach-ms is answered with: (waiting req entry), entry carrying :id, :uri, :query and :started. session-of names the reader's session in a request.

Guard `h`'s page loads (see the namespace doc). `waiting` renders the page a load past
`detach-ms` is answered with: `(waiting req entry)`, `entry` carrying `:id`, `:uri`,
`:query` and `:started`. `session-of` names the reader's session in a request.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close