Skip to content

Commit

Permalink
Aggressively disallow further connections, fixes #476
Browse files Browse the repository at this point in the history
  • Loading branch information
mperham committed May 17, 2024
1 parent 8e3c2d1 commit 9e2b654
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Changelog: Faktory || [Faktory Enterprise](https://github.com/contribsys/faktory

## 1.9.0

- Faktory now refuses further connections on :7419 if the connection count is larger than
allowed, 2000 in Faktory or your licensed amount in Faktory Enterprise. [#476]
- The `INFO` response has changed slightly, all elements now have well-defined types [#474]
Deprecate `client.Info` Go API, add new `client.CurrentState` Go API which
is almost identical to `client.Info` but has a strongly-typed response.
Expand Down
2 changes: 1 addition & 1 deletion server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package server

import "github.com/contribsys/faktory/util"

var DefaultMaxPoolSize = 1000
var DefaultMaxPoolSize = 2000

type ServerOptions struct {
Binding string
Expand Down
2 changes: 2 additions & 0 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,8 @@ func (s *Server) processLines(conn *Connection) {
// This will trigger in Faktory Enterprise if over the licensed connection count.
util.Warnf("%s has over %d active client connections and may exhibit poor performance. Ensure your worker processes are using no more than your licensed connection count.", client.Name, s.Options.PoolSize)
}
_ = conn.Error("Overloaded", fmt.Errorf("too many connections: %d", s.Stats.Connections))
return
}

for {
Expand Down
1 change: 1 addition & 0 deletions server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func runServer(binding string, runner func()) {
StorageDirectory: dir,
RedisSock: sock,
ConfigDirectory: os.ExpandEnv("test/.faktory"),
PoolSize: DefaultMaxPoolSize,
}
s, err := NewServer(opts)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions webui/web_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ func bootRuntime(t *testing.T, name string, fn func(*WebUI, *server.Server, *tes
Binding: "localhost:7418",
StorageDirectory: dir,
RedisSock: sock,
PoolSize: server.DefaultMaxPoolSize,
})

if err != nil {
Expand Down

0 comments on commit 9e2b654

Please sign in to comment.