Liking cljdoc? Tell your friends :D

wagoe.user.shell.session-pruner

Removes expired sessions on a schedule.

Expiry only hides a session: find-session-by-token filters on expires_at and revoked_at, so the reads stay correct while the table grows with every login, forever. Nothing deleted a row until BOU-429.

The schedule lives here rather than in the jobs module because jobs is optional and the user module is not — a deployment that never enables jobs still has the table. One timer per process: every replica prunes, which is harmless, because a DELETE that finds nothing costs a single indexed scan and two replicas deleting the same rows is the same DELETE twice.

Removes expired sessions on a schedule.

Expiry only hides a session: `find-session-by-token` filters on `expires_at`
and `revoked_at`, so the reads stay correct while the table grows with every
login, forever. Nothing deleted a row until BOU-429.

The schedule lives here rather than in the jobs module because jobs is
optional and the user module is not — a deployment that never enables jobs
still has the table. One timer per process: every replica prunes, which is
harmless, because a DELETE that finds nothing costs a single indexed scan
and two replicas deleting the same rows is the same DELETE twice.
raw docstring

default-settingsclj

Retention is counted from expiry. Thirty days leaves enough history to answer "where was this account signed in" after an incident without keeping the row for ever.

Retention is counted from expiry. Thirty days leaves enough history to answer
"where was this account signed in" after an incident without keeping the
row for ever.
sourceraw docstring

prune-once!clj

(prune-once! session-repository {:keys [retention-days] :as _settings})

Delete sessions that expired more than :retention-days ago.

Returns the number of rows removed, or nil when the prune threw — this runs on a timer, and a failed prune must not take the schedule down with it.

Delete sessions that expired more than `:retention-days` ago.

Returns the number of rows removed, or nil when the prune threw — this runs
on a timer, and a failed prune must not take the schedule down with it.
sourceraw docstring

start!clj

(start! session-repository settings)

Begin pruning on the configured interval. Returns a handle for stop!.

The first run is one interval away, not at boot: a process that restarts in a crash loop would otherwise issue a DELETE per restart.

Begin pruning on the configured interval. Returns a handle for `stop!`.

The first run is one interval away, not at boot: a process that restarts in a
crash loop would otherwise issue a DELETE per restart.
sourceraw docstring

stop!clj

(stop! {:keys [executor]})

Stop the schedule. Safe to call on a nil handle.

Stop the schedule. Safe to call on a nil handle.
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