Browse Source

En cours de développement

master
losyme 7 months ago
parent
commit
d2a202384d
  1. 2
      workers/pool.go
  2. 14
      workers/supervisor.go

2
workers/pool.go

@ -53,8 +53,8 @@ func (p *pool) stopOneWorker() { // AFINIR: choix du worker ?
defer p.mutex.Unlock()
for _, worker := range p.workers {
delete(p.workers, worker.id)
worker.stop()
delete(p.workers, worker.id)
return
}
}

14
workers/supervisor.go

@ -41,13 +41,15 @@ func (s *supervisor) loop() {
for {
if !end {
if size := s.pool.size(); size != s.poolSize {
if size < s.poolSize {
s.pool.startOneWorker(s.eventCh)
} else {
s.pool.stopOneWorker()
}
size := s.pool.size()
if size < s.poolSize {
s.pool.startOneWorker(s.eventCh)
continue
}
if size > s.poolSize {
s.pool.stopOneWorker()
continue
}
}

Loading…
Cancel
Save