Skip to content

Job only running one time #4

@naglalakk

Description

@naglalakk

I'm wondering why my queue is not getting processed. When I run this code a single job is processed but then if I add debugging I see that the queue is just filling up. My code

main = do
	hworker <- create "notifier" (State state)
	forkIO (worker hworker)
	forkIO (monitor hworker)
	forever $ queue hworker (ServiceAction "test" "testing" 1) >> threadDelay 5000000

This should push a new job into the queue every 5 seconds, which it does. But it's not processing it. I checked the failed jobs queue and it's completely empty so they are not failing.

This is the Job instance

instance Job State ServiceJob where
	job (State mvar) (ServiceAction service action id) = do 
		clients <- takeMVar mvar
		let message = "service:" 
				   ++ (service) 
				   ++ "|action:" 
				   ++ (action) 
				   ++ "|id:" 
				   ++ show id
		print message >> return Success
		--broadcast (T.pack message) clients
		-- return Success
	job (State mvar) (SearchIndex service id) = do
		putStrLn "search"
		return Success

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions