Prepare verified laboratory 7 implementation and evidence

This commit is contained in:
rey
2026-11-17 17:32:06 +03:00
parent 20afc2c790
commit eb1b5c7b84
677 changed files with 208256 additions and 64 deletions
+32
View File
@@ -0,0 +1,32 @@
package queue
import (
"errors"
"github.com/redis/go-redis/v9"
"time"
)
var ErrClientConfiguration = errors.New("separate broker identities required")
// Clients parses configuration only; connecting/authenticating is deferred to
// the native client. No credential or original parser error reaches diagnostics.
func Clients(publishURL, consumeURL string) (*redis.Client, *redis.Client, error) {
p, e := redis.ParseURL(publishURL)
if e != nil {
return nil, nil, ErrClientConfiguration
}
c, e := redis.ParseURL(consumeURL)
if e != nil || p.Username == "" || c.Username == "" || p.Username == c.Username {
return nil, nil, ErrClientConfiguration
}
for _, o := range []*redis.Options{p, c} {
o.MaxRetries = -1
o.DialTimeout = time.Second
o.ReadTimeout = 2 * time.Second
o.WriteTimeout = time.Second
o.PoolSize = 2
o.MaxActiveConns = 2
o.MaxIdleConns = 1
}
return redis.NewClient(p), redis.NewClient(c), nil
}