good morning!!!!

Skip to content
Snippets Groups Projects
Commit 0a70d11d authored by Garet Halliday's avatar Garet Halliday
Browse files

revert

parent bbda49f6
No related branches found
No related tags found
No related merge requests found
......@@ -279,7 +279,21 @@ func (T *Pool) acquireServer(client *Client) *Server {
if serverID == uuid.Nil {
// TODO(garet) can this be run on same thread and only create a goroutine if scaling is possible?
go T.scaleUp()
done := make(chan struct{})
go func() {
start := time.Now()
for {
time.Sleep(1 * time.Second)
select {
case <-done:
return
default:
}
log.Printf("still waiting after %d in pool %p", start, T)
}
}()
serverID = T.options.Pooler.Acquire(client.GetID(), SyncModeBlocking)
close(done)
}
T.mu.RLock()
......
......@@ -3,7 +3,7 @@ package transaction
import "pggat/lib/gat/pool"
func Apply(options pool.Options) pool.Options {
options.Pooler = NewPooler()
options.Pooler = new(Pooler)
options.ParameterStatusSync = pool.ParameterStatusSyncDynamic
options.ExtendedQuerySync = true
options.ReleaseAfterTransaction = true
......
......@@ -12,12 +12,6 @@ type Pooler struct {
s schedulers.Scheduler
}
func NewPooler() *Pooler {
p := new(Pooler)
schedulers.Test(&p.s)
return p
}
func (T *Pooler) NewClient() uuid.UUID {
return T.s.NewUser()
}
......
......@@ -2,15 +2,12 @@ package schedulers
import (
"github.com/google/uuid"
"sync"
"time"
"tuxpa.in/a/zlog/log"
"pggat/lib/rob"
"pggat/lib/rob/schedulers/v2/job"
"pggat/lib/rob/schedulers/v2/sink"
"pggat/lib/util/maps"
"pggat/lib/util/pools"
"sync"
)
type Scheduler struct {
......@@ -26,22 +23,6 @@ type Scheduler struct {
mu sync.RWMutex
}
func Test(s *Scheduler) {
go func() {
for {
time.Sleep(1 * time.Second)
func() {
s.mu.RLock()
defer s.mu.RUnlock()
s.bmu.Lock()
defer s.bmu.Unlock()
log.Printf("%d sinks | %d backlogged jobs", len(s.sinks), len(s.backlog))
}()
}
}()
}
func (T *Scheduler) NewWorker() uuid.UUID {
worker := uuid.New()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment