Skip to content

Commit 771c04a

Browse files
fsaminsguiheux
authored andcommitted
fix(hatchery): try to speedup (#3035)
1 parent f31aca2 commit 771c04a

File tree

2 files changed

+1
-12
lines changed

2 files changed

+1
-12
lines changed

sdk/cdsclient/client_queue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func shrinkQueue(queue *sdk.WorkflowQueue, l int) time.Time {
3030
if l < 1 {
3131
l = 1
3232
}
33-
l = l * 2
33+
l = l * 3
3434
t0 := (*queue)[len(*queue)-1].Queued
3535

3636
queue.Sort()

sdk/hatchery/hatchery.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ func Create(h Interface) error {
7979
// Create a cache with a default expiration time of 3 second, and which
8080
// purges expired items every minute
8181
spawnIDs := cache.New(10*time.Second, 60*time.Second)
82-
// This is a local cache to avoid analysing a job twice at the same time
83-
receivedIDs := cache.New(5*time.Second, 60*time.Second)
8482

8583
sdk.GoRoutine("heartbeat", func() {
8684
hearbeat(h, h.Configuration().API.Token, h.Configuration().API.MaxHeartbeatFailures)
@@ -106,7 +104,6 @@ func Create(h Interface) error {
106104
// read the result channel in another goroutine to let the main goroutine start new workers
107105
sdk.GoRoutine("checkStarterResult", func() {
108106
for startWorkerRes := range workerStartResultChan {
109-
receivedIDs.Delete(string(startWorkerRes.request.id))
110107
if startWorkerRes.err != nil {
111108
errs <- startWorkerRes.err
112109
}
@@ -209,13 +206,6 @@ func Create(h Interface) error {
209206
continue
210207
}
211208

212-
// Check if the jobs has been received less than 10s ago
213-
if _, exist := receivedIDs.Get(string(j.ID)); exist {
214-
log.Debug("job %d is alrealy being analyzed", j.ID)
215-
continue
216-
}
217-
receivedIDs.SetDefault(string(j.ID), j.ID)
218-
219209
//Check if the jobs is concerned by a pending worker creation
220210
if _, exist := spawnIDs.Get(string(j.ID)); exist {
221211
log.Debug("job %d already spawned in previous routine", j.ID)
@@ -231,7 +221,6 @@ func Create(h Interface) error {
231221
//Check gracetime
232222
if j.QueuedSeconds < int64(h.Configuration().Provision.GraceTimeQueued) {
233223
log.Debug("job %d is too fresh, queued since %d seconds, let existing waiting worker check it", j.ID)
234-
receivedIDs.Delete(string(j.ID))
235224
continue
236225
}
237226

0 commit comments

Comments
 (0)