(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol)
| 23316 | } |
| 23317 | |
| 23318 | func (p *iClientRPCServiceProcessorCreateTimeseries) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { |
| 23319 | args := IClientRPCServiceCreateTimeseriesArgs{} |
| 23320 | var err2 error |
| 23321 | if err2 = args.Read(ctx, iprot); err2 != nil { |
| 23322 | iprot.ReadMessageEnd(ctx) |
| 23323 | x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) |
| 23324 | oprot.WriteMessageBegin(ctx, "createTimeseries", thrift.EXCEPTION, seqId) |
| 23325 | x.Write(ctx, oprot) |
| 23326 | oprot.WriteMessageEnd(ctx) |
| 23327 | oprot.Flush(ctx) |
| 23328 | return false, thrift.WrapTException(err2) |
| 23329 | } |
| 23330 | iprot.ReadMessageEnd(ctx) |
| 23331 | |
| 23332 | tickerCancel := func() {} |
| 23333 | // Start a goroutine to do server side connectivity check. |
| 23334 | if thrift.ServerConnectivityCheckInterval > 0 { |
| 23335 | var cancel context.CancelFunc |
| 23336 | ctx, cancel = context.WithCancel(ctx) |
| 23337 | defer cancel() |
| 23338 | var tickerCtx context.Context |
| 23339 | tickerCtx, tickerCancel = context.WithCancel(context.Background()) |
| 23340 | defer tickerCancel() |
| 23341 | go func(ctx context.Context, cancel context.CancelFunc) { |
| 23342 | ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) |
| 23343 | defer ticker.Stop() |
| 23344 | for { |
| 23345 | select { |
| 23346 | case <-ctx.Done(): |
| 23347 | return |
| 23348 | case <-ticker.C: |
| 23349 | if !iprot.Transport().IsOpen() { |
| 23350 | cancel() |
| 23351 | return |
| 23352 | } |
| 23353 | } |
| 23354 | } |
| 23355 | }(tickerCtx, cancel) |
| 23356 | } |
| 23357 | |
| 23358 | result := IClientRPCServiceCreateTimeseriesResult{} |
| 23359 | var retval *common.TSStatus |
| 23360 | if retval, err2 = p.handler.CreateTimeseries(ctx, args.Req); err2 != nil { |
| 23361 | tickerCancel() |
| 23362 | if err2 == thrift.ErrAbandonRequest { |
| 23363 | return false, thrift.WrapTException(err2) |
| 23364 | } |
| 23365 | x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing createTimeseries: " + err2.Error()) |
| 23366 | oprot.WriteMessageBegin(ctx, "createTimeseries", thrift.EXCEPTION, seqId) |
| 23367 | x.Write(ctx, oprot) |
| 23368 | oprot.WriteMessageEnd(ctx) |
| 23369 | oprot.Flush(ctx) |
| 23370 | return true, thrift.WrapTException(err2) |
| 23371 | } else { |
| 23372 | result.Success = retval |
| 23373 | } |
| 23374 | tickerCancel() |
| 23375 | if err2 = oprot.WriteMessageBegin(ctx, "createTimeseries", thrift.REPLY, seqId); err2 != nil { |
nothing calls this directly
no test coverage detected