 					if ((~~((new Date).getTime() / 1000)) - dirtyqueue > zmqWorking) and status_c.onqueue? and status_c.onqueue isnt s_wk._zmq.pending
 						console.log "Resync of Queue", status_c.onqueue, s_wk._zmq.pending
 						resyncQueue()
-					setImmediate -> next()
-			,(err)->
-				#it will never stop
-			)
+					updatingStatus = false
+			statusTimer = setInterval updateStatus, 500
 			datalog = 
 				gauge: ->
 				legauge: ->

			s_wc.send JSON.stringify(
				startup: os.hostname()
				jobsIds: jobs)

			on_message = (msg) ->
				updateState()
				#one more job
				c = if options.jsonpack then jsonpack.unpack(String(msg)) else JSON.parse(msg)
				args = ''
				if !c.exec? or jobIndex(c._id) > -1
					#tell mothership we already had this ..
					if jobIndex(c._id) isnt -1
						console.log 'already had ', c._id, ' :|'
						s_wc.send JSON.stringify(
							node:
								name: os.hostname()
								loadavg: os.loadavg()
								freemem: os.freemem()
								totamem: os.totalmem()
							jobIds: jobs)
					return
				jobs.push [c._id,c._rev]
				env = process.env
				env.jobId = c._id
				if !env.TMPDIR
					env.TMPDIR = '/var/tmp/'
				fs = require('fs')
				filePath = env.TMPDIR + c._id + '.json'
				console.log 'got job ', (c.exec.split("/").pop()).split(" ")[0], c._id, 'currently running', jobs.length
				#sent back teh status job
				s_wc.send JSON.stringify(
					node:
						name: os.hostname()
						loadavg: os.loadavg()
						freemem: os.freemem()
						totamem: os.totalmem()
					jobIds: jobs)
				for arg of c.args
					args += ' ' + arg + ' ' + c.args[arg]
				# preparing the command
				cmdpath = if options.basepath then options.basepath + '/' else ''
				cmdfin = ''
				execpaths = [
					'.js'
					'.coffee'
				]
				first = true
				c.exec.split(' ').forEach (el) ->
					add = false
					if !first
						execpaths.forEach (ec) ->
							if el.length > ec.length and el.substr(el.length - ec.length) == ec
								add = true
							return
					if add and !first
						cmdfin += ' ' + cmdpath + el
					else
						if first
							cmdfin += el
						else
							cmdfin += ' ' + el
					first = false
					return
				cmd = cmdpath + cmdfin + args
				#create a file for the arguments in env
				if c.env
					fs.writeFileSync filePath, JSON.stringify(c.env), 'utf-8'
				path = cmd.split('/')
				path.pop()
				path = path.join('/')
				env.PATH += ':' + path
				cmd = cmd.split(' ')
				cmd1 = cmd.shift()
				started = ~~((new Date).getTime() / 1000)
				#separating command from arguments
				require('child_process').execFile cmd1, cmd, {
					cwd: path
					env: env
				}, (error, stdout, stderr) ->
					if c.env and fs.existsSync(filePath)
						fs.unlinkSync filePath
					#erasing input file
					if stdout
						console.log 'stdout', cmd, stdout
					if error
						console.log 'error', c._id, cmd1, cmd, error
					#check if there is a file output
					file_ret = if fs.existsSync(env.TMPDIR + c._id + '_out.json') then fs.readFileSync(process.env.TMPDIR + c._id + '_out.json', 'utf8') else null
					#sending back the status
					s_wc.send JSON.stringify(
						id: c._id
						stdout: stdout
						error: error
						status: 3
						timeTaken: ~~((new Date).getTime() / 1000) - started
						node:
							name: os.hostname()
							loadavg: os.loadavg()
							freemem: os.freemem()
							totamem: os.totalmem()
						file: file_ret
						_rev: c._rev
						jobIds: jobs)
					#one less job
					jobs = jobs.filter (obj)->
						return true if obj[0] isnt c._id
					console.log 'job done', (c.exec.split("/").pop()).split(" ")[0], c._id, 'currently running', jobs.length
					if error and error.code == 'Unknown system errno 7' and options.err7 # unrecoverable error..
						#unrecoverable error
						console.log 'Unrecoverable error 7'
						process.exit 1
					updateState()
					return
				return

			#timed restart of job processing

					#console.log(s_wk_client._zmq.state,jobs.length,options.max,freemem);
					switch s_wk_client._zmq.state
						when zmq.STATE_CLOSED
							if heathOk()
								console.log 'connecting...'
								s_wk_client = zmq.socket('pull')
								s_wk_client.on 'message', on_message
								s_wk_client.connect options.uri
						when zmq.STATE_READY
							unless heathOk()
								console.log 'disconnecting...'
								s_wk_client.close()
								s_wk_client = '_zmq': 'state': zmq.STATE_CLOSED
