gRelay is an open source project written in Go that provides:
- Circuit Break ✔️
- Circuit Break + Relay ✔️
- Concurrecny Safe ✔️
$ go get github.com/grelay/grelay
-
Circuit Break
-
Circuit Break + Relay
Check our Contributing Guideline
gRelay is an open source project written in Go that provides the circuit break pattern with a relay idea behind.
License: MIT License
gRelay is an open source project written in Go that provides:
$ go get github.com/grelay/grelay
Circuit Break
Circuit Break + Relay
Check our Contributing Guideline
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
Describe alternatives you've considered
Additional context
Is your feature request related to a problem? Please describe.
In gRelay v0.0.x the default config is using goroutines which costs a lot of memory allocation as you can see in benchmark folder. To improve our future features, we need to do a refactor in our system.
Describe the solution you'd like
We would like to have an interface:
type grelayExec interface {
exec(service GrelayService, func() (interface{}, error)) (interface{}, error)
}
and an implementation of this interface:
type grelayExecWithGo struct {}
func (e grelayExecWithGo) exec(service GrelayService, func() (interface{}, error)) (interface{}, error) {
// implementation
}
Change the grelayServiceImpl struct:
type grelayServiceImpl struct {
// ...
realExec grelayExec
// ...
}
In NewGrelayService
creates grelayExecWithGo:
func NewGrelayService(c GrelayConfig) GrelayService {
var re grelayExec
if c.withGo {
re = grelayExecWithGo{}
}
g := &grelayServiceImpl{
// ...
realExec: re
}
// ...
}
In GrelayConfig include WithGo
method and withGo
attribute (put withGo = true as default in the future it will be false):
type GrelayConfig struct {
// ...
withGo bool
}
func NewGrelayConfig() GrelayConfig {
return GrelayConfig{
withGo: true,
}
}
func (c GrelayConfig) WithGo() GrelayConfig {
c.withGo = true
return c
}
move grelayServiceImpl.exec(f func() (interface{}, error))
to grelayExecWithGo.exec(service GrelayService, func() (interface{}, error))
. In the final, we would like to have the grelayServiceImpl.exec(f func() (interface{}, error))
like that:
func (g *grelayServiceImpl) exec(f func() (interface{}, error)) (interface{}, error) {
return g.realExec.exec(g, f)
}
Describe the bug
The test called: TestGrelayRequestExecWithOneItemInQueueReturningErrGrelayServiceTimedoutShouldReturnErrGrelayServiceTimedout
is falling in branch refactoring
when we try to run make test-race-condition
. We need to solve this issue before merge this PR to main.
The current implementation works sometimes and other don't. We need to understand and fix this bug.
To Reproduce
Steps to reproduce the behavior:
go test ./... -cpu=1,9 -race -count=50 -failfast -run GrelayRequestExecWithOneItemInQueueReturningErrGrelayServiceTimedoutShouldReturnErrGrelayServiceTimedout
many timesExpected behavior
The test should pass without problems.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.