Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closer interface for kite methods. #53

Open
fatih opened this issue Aug 8, 2014 · 0 comments
Open

Closer interface for kite methods. #53

fatih opened this issue Aug 8, 2014 · 0 comments

Comments

@fatih
Copy link
Contributor

fatih commented Aug 8, 2014

Our kite handler only satisfies currently this interface:

type Handler interface {
    ServeKite(*Request) (result interface{}, err error)
}

This is sufficient to handle and call a method. We should add a new feature to http://godoc.org/github.com/koding/kite#Kite.Close that when closed it should check whether a method also supports http://golang.org/pkg/io/#Closer, if yes it should call it. Example implementation:

func (k *Kite) Close() {
    //...

    for _, method := range k.handlers {
        if m, ok := method.(io.Closer); ok {
            m.Close()
        }
    }
}

This is helpful for graceful shutdown of a kite or cleaning up resources for some specific methods. This is an idea and open to suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant