gocraft / work

Process background jobs in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Usage Example

leanderme opened this issue · comments

Hi,

I'm following allong the example process jobs in the README and trying to get it to work.

in main.go, I'm calling StartWorkers() which is equivalent to the main func of the example. Later, I'm enqueuing a job after an incoming HTTP request.

Now it seems like StartWorkers() seems to block the HTTP request as no connections are accepted after calling StartWorkers().

I'm sure this is a beginner question and that there is a trivial mistake, but I can't figure it out.

Edit: Found that

       // Wait for a signal to quit:
	signalChan := make(chan os.Signal, 1)
	signal.Notify(signalChan, os.Interrupt, os.Kill)
	<-signalChan

	// Stop the pool
	pool.Stop()

was the "problem".