influxdb-client-csharp icon indicating copy to clipboard operation
influxdb-client-csharp copied to clipboard

Writing data with Sync API fails silently

Open francotiveron opened this issue 1 year ago • 2 comments

I am using the following F# code to write

let write org bucket (callback: SeriesWriteEvent -> unit) (options: WriteOptions) (points: PointData array) = 
    log.Information("Writing {0} points in bucket {Organization}/{Bucket}", points.Length, org, bucket)
    use wApi = client.GetWriteApi(options)

    use _ = wApi.EventHandler |> Event.subscribe (fun (ea: EventArgs) ->
        match ea with
        | :? WriteSuccessEvent as ea -> BatchWritten options.BatchSize
        | :? WriteErrorEvent as ea -> BatchError ea.Exception
        | :? WriteRetriableErrorEvent as ea -> BatchRetry (ea.Exception, options.BatchSize, ea.RetryInterval)
        | :? WriteRuntimeExceptionEvent as ea -> BatchError ea.Exception
        |> callback)

    try
        wApi.WritePoints(points, bucket, org) 
    with | x -> log.Error(x, "Write Error")

The writing starts as expected. But, after a partial number of points is written (I am writing for example 200000 of the 1.5 million), the function returns without any error. The WriteSuccessEvent is called for 10 to 20 batches and then stops for a few seconds, and finally wApi.WritePoints simply returns without triggering any event (Retry or Error) nor throwing an exception.

francotiveron avatar Sep 22 '23 08:09 francotiveron