redis-adapter
redis-adapter copied to clipboard
redis adapter panics when redis is down, maybe handle it with an error?
@tangyang9464 @JalinWang @imp2002
@sujatapatnaik52 can you paste the panic code stack here?
@JalinWang
/cc @tangyang9464
root@dev:/home/sujata/learning/casbin_fixes# go run main.go
panic: dial tcp 127.0.0.1:6379: connect: connection refused
goroutine 1 [running]:
github.com/casbin/redis-adapter/v2.(*Adapter).open(0xc0000b2230)
/root/go/pkg/mod/github.com/casbin/redis-adapter/[email protected]/adapter.go:127 +0x12a
github.com/casbin/redis-adapter/v2.newAdapter({0x6bfe00, 0x3}, {0x6c2425, 0xe}, {0x6c1ded, 0xc}, {0x0, 0x0})
/root/go/pkg/mod/github.com/casbin/redis-adapter/[email protected]/adapter.go:60 +0x105
github.com/casbin/redis-adapter/v2.NewAdapter(...)
/root/go/pkg/mod/github.com/casbin/redis-adapter/[email protected]/adapter.go:70
main.main()
/home/sujata/learning/casbin_fixes/main.go:195 +0x70
exit status 2
@JalinWang
@tangyang9464 Do you think how should we design the behavior?
I think panic is reasonable 🤔Or do we need to introduce a retry mechanism?
@JalinWang should return error instead of panic, at the same time, a retry mechanism can be added
@imp2002
:tada: This issue has been resolved in version 3.0.0 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket: