@jenova-marie/wonder-logger - v1.0.12
    Preparing search index...

    Function withBackpressure

    • RxJS operator to apply backpressure handling

      Prevents overwhelming subscribers by throttling or buffering log emissions. Choose either throttle (emit one log per interval) or buffer (emit arrays).

      Parameters

      Returns OperatorFunction<RawLogEntry, RawLogEntry | RawLogEntry[]>

      Operator function that applies backpressure

      // Throttle: emit max one log per second
      logs$.pipe(
      withBackpressure({ throttleMs: 1000 })
      ).subscribe(log => sendToSlack(log))
      // Buffer: emit batches every 5 seconds
      logs$.pipe(
      withBackpressure({ bufferMs: 5000 })
      ).subscribe(logs => bulkInsertToDb(logs))