(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol)
| 23711 | } |
| 23712 | |
| 23713 | func (p *iClientRPCServiceProcessorInsertRecord) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { |
| 23714 | args := IClientRPCServiceInsertRecordArgs{} |
| 23715 | var err2 error |
| 23716 | if err2 = args.Read(ctx, iprot); err2 != nil { |
| 23717 | iprot.ReadMessageEnd(ctx) |
| 23718 | x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) |
| 23719 | oprot.WriteMessageBegin(ctx, "insertRecord", thrift.EXCEPTION, seqId) |
| 23720 | x.Write(ctx, oprot) |
| 23721 | oprot.WriteMessageEnd(ctx) |
| 23722 | oprot.Flush(ctx) |
| 23723 | return false, thrift.WrapTException(err2) |
| 23724 | } |
| 23725 | iprot.ReadMessageEnd(ctx) |
| 23726 | |
| 23727 | tickerCancel := func() {} |
| 23728 | // Start a goroutine to do server side connectivity check. |
| 23729 | if thrift.ServerConnectivityCheckInterval > 0 { |
| 23730 | var cancel context.CancelFunc |
| 23731 | ctx, cancel = context.WithCancel(ctx) |
| 23732 | defer cancel() |
| 23733 | var tickerCtx context.Context |
| 23734 | tickerCtx, tickerCancel = context.WithCancel(context.Background()) |
| 23735 | defer tickerCancel() |
| 23736 | go func(ctx context.Context, cancel context.CancelFunc) { |
| 23737 | ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) |
| 23738 | defer ticker.Stop() |
| 23739 | for { |
| 23740 | select { |
| 23741 | case <-ctx.Done(): |
| 23742 | return |
| 23743 | case <-ticker.C: |
| 23744 | if !iprot.Transport().IsOpen() { |
| 23745 | cancel() |
| 23746 | return |
| 23747 | } |
| 23748 | } |
| 23749 | } |
| 23750 | }(tickerCtx, cancel) |
| 23751 | } |
| 23752 | |
| 23753 | result := IClientRPCServiceInsertRecordResult{} |
| 23754 | var retval *common.TSStatus |
| 23755 | if retval, err2 = p.handler.InsertRecord(ctx, args.Req); err2 != nil { |
| 23756 | tickerCancel() |
| 23757 | if err2 == thrift.ErrAbandonRequest { |
| 23758 | return false, thrift.WrapTException(err2) |
| 23759 | } |
| 23760 | x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing insertRecord: " + err2.Error()) |
| 23761 | oprot.WriteMessageBegin(ctx, "insertRecord", thrift.EXCEPTION, seqId) |
| 23762 | x.Write(ctx, oprot) |
| 23763 | oprot.WriteMessageEnd(ctx) |
| 23764 | oprot.Flush(ctx) |
| 23765 | return true, thrift.WrapTException(err2) |
| 23766 | } else { |
| 23767 | result.Success = retval |
| 23768 | } |
| 23769 | tickerCancel() |
| 23770 | if err2 = oprot.WriteMessageBegin(ctx, "insertRecord", thrift.REPLY, seqId); err2 != nil { |
nothing calls this directly
no test coverage detected