QUIC transport

This commit is contained in:
Neil Alexander
2023-11-03 14:03:41 +00:00
parent 50182bf0a8
commit f11efc2c8d
5 changed files with 160 additions and 261 deletions

View File

@@ -39,7 +39,7 @@ func NewQueues(config *config.Config, log *log.Logger, transport transport.Trans
Transport: transport,
Storage: storage,
}
go qs.manager()
time.AfterFunc(time.Second*5, qs.manager)
return qs
}
@@ -51,7 +51,7 @@ func (qs *Queues) manager() {
for _, destination := range destinations {
_, _ = qs.queueFor(destination)
}
time.AfterFunc(time.Minute*10, qs.manager)
time.AfterFunc(time.Minute, qs.manager)
}
func (qs *Queues) QueueFor(from string, rcpts []string, content []byte) error {
@@ -90,7 +90,7 @@ func (qs *Queues) queueFor(server string) (*Queue, error) {
if !ok {
return nil, fmt.Errorf("type assertion error")
}
if q.running.CAS(false, true) {
if q.running.CompareAndSwap(false, true) {
go q.run()
}
return q, nil