Skip to content

Commit 9ed8992

Browse files
committed
Format by gofmt/gofumpt (gofumpt -l -w .)
1 parent a876d42 commit 9ed8992

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

worker/pool.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ func (workerPoolSelf *DefaultWorkerPool) generateWorkerWithMaximum(maximum int)
192192
workerPoolSelf.lock.Lock()
193193
workerPoolSelf.workerCount--
194194
if isBusy {
195-
workerPoolSelf.workerBusy --
195+
workerPoolSelf.workerBusy--
196196
}
197197
workerPoolSelf.lock.Unlock()
198198
}()
@@ -211,13 +211,13 @@ func (workerPoolSelf *DefaultWorkerPool) generateWorkerWithMaximum(maximum int)
211211
if job != nil {
212212
workerPoolSelf.lock.Lock()
213213
isBusy = true
214-
workerPoolSelf.workerBusy ++
214+
workerPoolSelf.workerBusy++
215215
workerPoolSelf.lock.Unlock()
216216

217217
job()
218218

219219
workerPoolSelf.lock.Lock()
220-
workerPoolSelf.workerBusy --
220+
workerPoolSelf.workerBusy--
221221
isBusy = false
222222
workerPoolSelf.lock.Unlock()
223223
}

worker/pool_test.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func TestWorkerJamDuration(t *testing.T) {
100100
defaultWorkerPool := NewDefaultWorkerPool(fpgo.NewBufferedChannelQueue[func()](3, 10000, 100), nil).
101101
SetSpawnWorkerDuration(1 * time.Millisecond / 10).
102102
SetWorkerExpiryDuration(5 * time.Millisecond).
103-
SetWorkerJamDuration(3 * time.Millisecond).
103+
SetWorkerJamDuration(3 * time.Millisecond).
104104
SetWorkerSizeMaximum(10).
105105
SetWorkerSizeStandBy(3).
106106
SetWorkerBatchSize(0)
@@ -109,14 +109,14 @@ func TestWorkerJamDuration(t *testing.T) {
109109

110110
// Test Spawn
111111
assert.Equal(t, 0, defaultWorkerPool.workerCount)
112-
anyOneDone := false
112+
anyOneDone := false
113113
for i := 0; i < 3; i++ {
114114
v := i
115115
err = workerPool.Schedule(func() {
116116
// Nothing to do
117117
time.Sleep(20 * time.Millisecond)
118118
t.Log(v)
119-
anyOneDone = true
119+
anyOneDone = true
120120
})
121121
assert.NoError(t, err)
122122
}
@@ -127,20 +127,20 @@ func TestWorkerJamDuration(t *testing.T) {
127127
// Though there're blocking jobs, but no newest job goes into the queue
128128
assert.Equal(t, 3, defaultWorkerPool.workerCount)
129129
// There're new jobs going to the queue, and all goroutines are busy
130-
workerPool.Schedule(func(){})
131-
workerPool.Schedule(func(){})
132-
workerPool.Schedule(func(){})
133-
time.Sleep(3 * time.Millisecond)
130+
workerPool.Schedule(func() {})
131+
workerPool.Schedule(func() {})
132+
workerPool.Schedule(func() {})
133+
time.Sleep(3 * time.Millisecond)
134134
// A new expected goroutine is generated
135-
assert.Equal(t, 4, defaultWorkerPool.workerCount)
136-
workerPool.Schedule(func(){})
137-
workerPool.Schedule(func(){})
138-
workerPool.Schedule(func(){})
135+
assert.Equal(t, 4, defaultWorkerPool.workerCount)
136+
workerPool.Schedule(func() {})
137+
workerPool.Schedule(func() {})
138+
workerPool.Schedule(func() {})
139139
time.Sleep(3 * time.Millisecond)
140140
// Only non blocking jobs, thus keep the same amount
141141
assert.Equal(t, 4, defaultWorkerPool.workerCount)
142142
// There's a blocking jobs going to the queue
143-
workerPool.Schedule(func(){
143+
workerPool.Schedule(func() {
144144
time.Sleep(20 * time.Millisecond)
145145
t.Log(3)
146146
anyOneDone = true
@@ -149,12 +149,12 @@ func TestWorkerJamDuration(t *testing.T) {
149149
// Though there're blocking jobs, but no newest job goes into the queue
150150
assert.Equal(t, 4, defaultWorkerPool.workerCount)
151151
// There're new jobs going to the queue, and all goroutines are busy
152-
workerPool.Schedule(func(){})
153-
workerPool.Schedule(func(){})
154-
workerPool.Schedule(func(){})
155-
workerPool.Schedule(func(){})
156-
assert.Equal(t, false, anyOneDone)
157-
time.Sleep(1 * time.Millisecond)
152+
workerPool.Schedule(func() {})
153+
workerPool.Schedule(func() {})
154+
workerPool.Schedule(func() {})
155+
workerPool.Schedule(func() {})
156+
assert.Equal(t, false, anyOneDone)
157+
time.Sleep(1 * time.Millisecond)
158158
// A new expected goroutine is generated
159159
assert.Equal(t, 5, defaultWorkerPool.workerCount)
160160
}

0 commit comments

Comments
 (0)