-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.go
More file actions
30 lines (25 loc) · 984 Bytes
/
main.go
File metadata and controls
30 lines (25 loc) · 984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package main
import "fmt"
func main() {
// Create new tasks
tasks := []Task{
&EmailTask{Email: "email1@codeheim.io", Subject: "test", MessageBody: "test"},
&ImageProcessingTask{ImageUrl: "/images/sample1.jpg"},
&EmailTask{Email: "email2@codeheim.io", Subject: "test", MessageBody: "test"},
&ImageProcessingTask{ImageUrl: "/images/sample2.jpg"},
&EmailTask{Email: "email3@codeheim.io", Subject: "test", MessageBody: "test"},
&ImageProcessingTask{ImageUrl: "/images/sample3.jpg"},
&EmailTask{Email: "email4@codeheim.io", Subject: "test", MessageBody: "test"},
&ImageProcessingTask{ImageUrl: "/images/sample4.jpg"},
&EmailTask{Email: "email5@codeheim.io", Subject: "test", MessageBody: "test"},
&ImageProcessingTask{ImageUrl: "/images/sample5.jpg"},
}
// Create a worker pool
wp := WorkerPool{
Tasks: tasks,
concurrency: 5, // Number of workers that can run at a time
}
// Run the pool
wp.Run()
fmt.Println("All tasks have been processed!")
}