freeze_writes

freeze_writes — controls when writes are sent to the DataHub engine.

Synopsis

freeze_writes (t|nil)

Arguments

t|nil

Calling this function with a true value (t) collects all subsequent datahub_write calls in an internal buffer. A nil value sends the accumulated calls to the DataHub engine in a single call, and re-enables normal datahub_write calls.

Returns

t on success, otherwise an error message.

Description

When writing large numbers of points to the DataHub engine the thread context switch adds significant delay. Using this function allows write requests to accumulate in an internal buffer and get sent all at one time. Use like this:

  1. Call freeze_writes(t).

  2. Call datahub_write multiple times as needed (within reason).

  3. Call freeze_writes(nil). This will execute all the preceding writes in a single call

See also datahub_write.