flush

open suspend fun flush(key: SessionKey? = null)

Waits until the writes appended before this call are persisted: those to key, or to every session when key is null. Canceling the caller stops the wait, not the writes.

The default does nothing, which suits a service that persists each write before returning; a service that buffers writes overrides it, and a service that wraps another passes it on.

Parameters

key

The session to flush, or null for every session. A non-null key needs a non-null SessionKey.id.

Throws

if a buffered write could not be persisted.