(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol)
| 23948 | } |
| 23949 | |
| 23950 | func (p *iClientRPCServiceProcessorInsertTablets) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { |
| 23951 | args := IClientRPCServiceInsertTabletsArgs{} |
| 23952 | var err2 error |
| 23953 | if err2 = args.Read(ctx, iprot); err2 != nil { |
| 23954 | iprot.ReadMessageEnd(ctx) |
| 23955 | x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) |
| 23956 | oprot.WriteMessageBegin(ctx, "insertTablets", thrift.EXCEPTION, seqId) |
| 23957 | x.Write(ctx, oprot) |
| 23958 | oprot.WriteMessageEnd(ctx) |
| 23959 | oprot.Flush(ctx) |
| 23960 | return false, thrift.WrapTException(err2) |
| 23961 | } |
| 23962 | iprot.ReadMessageEnd(ctx) |
| 23963 | |
| 23964 | tickerCancel := func() {} |
| 23965 | // Start a goroutine to do server side connectivity check. |
| 23966 | if thrift.ServerConnectivityCheckInterval > 0 { |
| 23967 | var cancel context.CancelFunc |
| 23968 | ctx, cancel = context.WithCancel(ctx) |
| 23969 | defer cancel() |
| 23970 | var tickerCtx context.Context |
| 23971 | tickerCtx, tickerCancel = context.WithCancel(context.Background()) |
| 23972 | defer tickerCancel() |
| 23973 | go func(ctx context.Context, cancel context.CancelFunc) { |
| 23974 | ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) |
| 23975 | defer ticker.Stop() |
| 23976 | for { |
| 23977 | select { |
| 23978 | case <-ctx.Done(): |
| 23979 | return |
| 23980 | case <-ticker.C: |
| 23981 | if !iprot.Transport().IsOpen() { |
| 23982 | cancel() |
| 23983 | return |
| 23984 | } |
| 23985 | } |
| 23986 | } |
| 23987 | }(tickerCtx, cancel) |
| 23988 | } |
| 23989 | |
| 23990 | result := IClientRPCServiceInsertTabletsResult{} |
| 23991 | var retval *common.TSStatus |
| 23992 | if retval, err2 = p.handler.InsertTablets(ctx, args.Req); err2 != nil { |
| 23993 | tickerCancel() |
| 23994 | if err2 == thrift.ErrAbandonRequest { |
| 23995 | return false, thrift.WrapTException(err2) |
| 23996 | } |
| 23997 | x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing insertTablets: " + err2.Error()) |
| 23998 | oprot.WriteMessageBegin(ctx, "insertTablets", thrift.EXCEPTION, seqId) |
| 23999 | x.Write(ctx, oprot) |
| 24000 | oprot.WriteMessageEnd(ctx) |
| 24001 | oprot.Flush(ctx) |
| 24002 | return true, thrift.WrapTException(err2) |
| 24003 | } else { |
| 24004 | result.Success = retval |
| 24005 | } |
| 24006 | tickerCancel() |
| 24007 | if err2 = oprot.WriteMessageBegin(ctx, "insertTablets", thrift.REPLY, seqId); err2 != nil { |
nothing calls this directly
no test coverage detected