v / examples
Raw file
		
1import net.http
2import sync
3import time
4
5fn send_request(mut wg sync.WaitGroup) ?string {
6 start := time.ticks()
7 data := http.get('https://google.com')?
8 finish := time.ticks()
9 println('Finish getting time ${finish - start} ms')
10 wg.done()
11 return data.body
12}
13
14fn main() {
15 mut wg := sync.new_waitgroup()
16 for i := 0; i < 50; i++ {
17 wg.add(1)
18 go send_request(mut wg)
19 }
20 wg.wait()
21}