Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ Configuration parameters are loaded from environment variables on startup. Refer
| `AC_GATEWAY_ADDR` | `127.0.0.1:5100` | Gateway HTTP service listen address |
| `AC_DATABASE_URL` | `postgres://aethercode:aethercode@127.0.0.1:5433/aethercode_exec` | PostgreSQL connection DSN |
| `AC_REDIS_ADDR` | `127.0.0.1:6379` | Redis host address and port |
| `AC_REDIS_PASSWORD` | _(empty)_ | Redis password, when the server requires one |
| `AC_JUDGE_URL` | `http://127.0.0.1:5050` | go-judge sandbox REST API endpoint |
| `AC_JUDGE_TOKEN` | *(Required)* | Secret bearer token authenticating requests to go-judge |
| `AC_WORKER_COUNT` | `8` | Total concurrent worker execution goroutines |
Expand Down
1 change: 1 addition & 0 deletions cmd/stj-exec/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func main() {
// Redis
rdb := redis.NewClient(&redis.Options{
Addr: cfg.RedisAddr,
Password: cfg.RedisPassword,
PoolSize: cfg.RedisPool,
MinIdleConns: cfg.RedisMinIdle,
})
Expand Down
14 changes: 8 additions & 6 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ import (
)

type Config struct {
GatewayAddr string
DatabaseURL string
RedisAddr string
JudgeURL string
JudgeToken string
WorkerCount int
GatewayAddr string
DatabaseURL string
RedisAddr string
RedisPassword string
JudgeURL string
JudgeToken string
WorkerCount int
// Connection pool sizes. The defaults suit up to about 128 concurrent
// database users; ingest alone can use 512 at once (see the admission
// semaphore), so raise DBMaxConns before raising ingest concurrency.
Expand Down Expand Up @@ -86,6 +87,7 @@ func Load() Config {
GatewayAddr: env("AC_GATEWAY_ADDR", "127.0.0.1:5100"),
DatabaseURL: env("AC_DATABASE_URL", "postgres://aethercode:aethercode@127.0.0.1:5433/aethercode_exec"),
RedisAddr: env("AC_REDIS_ADDR", "127.0.0.1:6379"),
RedisPassword: env("AC_REDIS_PASSWORD", ""),
JudgeURL: env("AC_JUDGE_URL", "http://127.0.0.1:5050"),
JudgeToken: env("AC_JUDGE_TOKEN", ""),
WorkerCount: envInt("AC_WORKER_COUNT", 8),
Expand Down
6 changes: 6 additions & 0 deletions internal/queue/hub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ func TestHub_AClientThatFallsBehindIsClosedSoItReplays(t *testing.T) {
defer cancel()
slow := ps.Subscribe(ctx, "job-d")
fast := ps.Subscribe(ctx, "job-e")
// The hub subscribes to Redis in the background: wait until it is live, or
// early events are lost and the buffer never overflows.
if err := ps.PublishEvent(ctx, eventlog.New("job-e", eventlog.EventRunning, nil)); err != nil {
t.Fatal(err)
}
recv(t, fast)

for i := 0; i < subscriberBuffer+5; i++ {
if err := ps.PublishEvent(ctx, eventlog.New("job-d", eventlog.EventRunning, nil)); err != nil {
Expand Down
Loading