GithubHelp home page GithubHelp logo

jrpc's People

Contributors

loozhengyuan avatar paskal avatar umputun avatar zebox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

jrpc's Issues

Move out all middlewares

Currently middleware selection is very opinionated and in some cases user may not like the provided set. Instead to hardcoding it will be better to allow injection of any middlewares user needs.

Probably some may stay mandatory, probably NoCache and Ping, but others (limiter, logger, recovery, throttler and RealIP) should be passed in.

Leaking goroutine on Server.Run

With following change in place I see report on leaking goroutines:

diff --git a/server_test.go b/server_test.go
index 30c07d5..851c09a 100644
--- a/server_test.go
+++ b/server_test.go
@@ -12,9 +12,11 @@ import (
 	"github.com/pkg/errors"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
+	"go.uber.org/goleak"
 )
 
 func TestServerPrimitiveTypes(t *testing.T) {
+	defer goleak.VerifyNone(t)
 	s := Server{API: "/v1/cmd", Logger: NoOpLogger}
 
 	type respData struct {

Report:

=== RUN   TestServerPrimitiveTypes
--- FAIL: TestServerPrimitiveTypes (0.46s)
    server_test.go:32: [blah 42 true]
    server_test.go:32: [blah 42 true]
    leaks.go:78: found unexpected goroutines:
        [Goroutine 37 in state select, with github.com/patrickmn/go-cache.(*janitor).Run on top of the stack:
        goroutine 37 [select]:
        github.com/patrickmn/go-cache.(*janitor).Run(0xc00011c3c0, 0xc000132880)
        	/Users/dmitry/go/pkg/mod/github.com/patrickmn/go-cache@v2.1.0+incompatible/cache.go:1079 +0xd5
        created by github.com/patrickmn/go-cache.runJanitor
        	/Users/dmitry/go/pkg/mod/github.com/patrickmn/go-cache@v2.1.0+incompatible/cache.go:1099 +0xa9
        
         Goroutine 38 in state select, with github.com/patrickmn/go-cache.(*janitor).Run on top of the stack:
        goroutine 38 [select]:
        github.com/patrickmn/go-cache.(*janitor).Run(0xc00011c3d0, 0xc0001328c0)
        	/Users/dmitry/go/pkg/mod/github.com/patrickmn/go-cache@v2.1.0+incompatible/cache.go:1079 +0xd5
        created by github.com/patrickmn/go-cache.runJanitor
        	/Users/dmitry/go/pkg/mod/github.com/patrickmn/go-cache@v2.1.0+incompatible/cache.go:1099 +0xa9
        ]

I haven't yet figured out what is the root cause and or how to fix it.

The effect of this leak is unknown to me, I just know that's it's visible with goleak tool both in this project and also in remark42 which uses it. Feel free to close if you don't think it's worth investigating.

Remove chi dependency

It should work with any mux and not depend on chi exclusively. This will minimize external dependencies and allow user to pick any router. The infamous go-chi/chi/issues/561 proved - such a hard dependency is not the best idea and switching to smth else should be allowed and supported.

#8 should be addressed first as it has some chi dependencies in the list of used middlewares

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.