 			workque = []
 			maxquelen = 1000
 			jumpon = 0
+			lastcount = 
+				working: 0
+				queue: 0
 			findinque = (id)->
 				for obj,ix in workque
 					return workque[ix] if obj._id is id

									if workque[index]._status is "fetching"
										workque[index] = doc
									else
										#it was a gosth job
										console.log "updating info for ghost job", doc._id
										doc._status = workque[index]._status
										doc._takenby = workque[index]._takenby if workque[index]._takenby?

				return
			), 1)
			getDocsCargo = async.cargo(((couch_toprocess, callback) ->
				if !r.ready or os.freemem() < config.minMem * 1048576 or lastcount.queue > (lastcount.working * 2)
					setImmediate ->
						getDocsCargo.push couch_toprocess
						callback()
