LANDSCAPE

flush

Send the in-memory batch and attempt to upload the durable queue.

Flush now

import { flush } from "@hyperreal/landscape-core";

await flush();

Signature

function flush(): Promise<void>

Waits until the client is ready, flushes the in-memory batch, then uploads the durable queue.

Automatic flushes

Batches also flush when:

  • the buffer reaches batchSize (default 10)
  • flushIntervalMs elapses (default 5000)
  • pagehide fires
  • visibilitychange moves the document to hidden

Transport and failures

HttpTransport tries sendBeacon, then fetch with keepalive, then fetch.

Failed sends leave events in the event store. The retry scheduler drains later (retryBaseMs default 1000, retryMaxMs default 60000). Offline (navigator.onLine === false) skips upload and schedules retry.