func()

in component/block_cache/threadpool.go [136:174]


func (t *ThreadPool) Do(priority bool) {
	defer t.wg.Done()

	if priority {
		// This thread will work only on high priority channel
		for {
			select {
			case item := <-t.priorityCh:
				if item.upload {
					t.writer(item)
				} else {
					t.reader(item)
				}
			case <-t.close:
				return
			}
		}
	} else {
		// This thread will work only on both high and low priority channel
		for {
			select {
			case item := <-t.priorityCh:
				if item.upload {
					t.writer(item)
				} else {
					t.reader(item)
				}
			case item := <-t.normalCh:
				if item.upload {
					t.writer(item)
				} else {
					t.reader(item)
				}
			case <-t.close:
				return
			}
		}
	}
}