[ 
https://issues.apache.org/jira/browse/THRIFT-4448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16318965#comment-16318965
 ] 

ASF GitHub Bot commented on THRIFT-4448:
----------------------------------------

Github user dcelasun commented on the issue:

    https://github.com/apache/thrift/pull/1459
  
    > I personally think dropping go1.6/x/net/context support is best for the 
project. Are you the right person to make that call?
    
    Sounds good to me, but we need to run it by someone with commit bits. cc 
@Jens-G @jeking3 
    
    > Related question: why was 'context support' added when it doesn't seem to 
be hooked up to anything in the library? Seems like the method signatures were 
the only thing that changed.
    
    It was added to support passing arbitrary values into RPC handlers. One of 
the big use cases was accessing client IP from an RPC handler. Before 
`context`, this was impossible since the underlying transport was not visible 
to the handler. Now, you can implement a custom `TProcessor` that embeds the 
generated processor, and pass the IP manually, something like:
    
    ```go
    type MyProcessor struct {
        *GeneratedProcessor
    }
    
    func (p *MyProcessor) Process(ctx context.Context, in, out TProtocol) 
(bool, TException) {
        name, _, seqId, err := iprot.ReadMessageBegin()
                if err != nil {
                        return false, err
                }
                if processor, ok := p.GetProcessorFunction(name); ok {
                        //TODO: get IP from transport and add to ctx
                
                        return processor.Process(ctx, seqId, iprot, oprot)
                }
                
                // rest of it...
        }
    }
    
    ```


> Golang: do something with context.Context
> -----------------------------------------
>
>                 Key: THRIFT-4448
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4448
>             Project: Thrift
>          Issue Type: Task
>          Components: Go - Library
>    Affects Versions: 0.11.0
>            Reporter: John Boiles
>
> PR Here: https://github.com/apache/thrift/pull/1459
> This patch wires through {{context.Context}} such that it can be used in in 
> {{http.Request}}'s {{WithContext}} method. This allows Thrift HTTP requests 
> to canceled or timed out via the context.
> This patch breaks support for go<1.7 so it's not ready to ship, but I'm 
> hoping to get some direction on this. When does Thrift expect to drop support 
> of go1.7? It looks like the current solution is to duplicate files that need 
> to use {{golang.org/x/net/context}} and add a {{// +build !go1.7}} but 
> duplication seems unsustainable as the {{context}} package is imported more 
> places.
> Go 1.7 was released 15 August 2016. Given Golang has had significant 
> performance improvements in most dot releases, I suspect most production 
> services stay reasonably up to date. Here at Periscope/Twitter we're on 
> go1.9.1, and we're a fairly large organization.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to