private void setDoneWorking(Job job) { setProcssed(); Resque.redis().Keys.Remove(0,"resque:worker:" + workerId()); }
private void setWorkingOn(Job job) { job.worker = this; string data = Resque.encode(new Dictionary<string, object>() { { "queue", job.queue }, { "run_at", currentTimeFormatted() }, { "payload", job.payload } }); //Resque.redis().Set(new Dictionary<string, byte[]>() { { startedKey(), Encoding.UTF8.GetBytes(currentTimeFormatted()) } }); Resque.redis().Strings.Set(0,new Dictionary<string, byte[]>() { { "resque:worker:" + workerId(), Encoding.UTF8.GetBytes(data) } }, false); //Resque.redis().Set("resque:worker:" + workerId(), data); }
private void process(Job job, Func<Job, bool> block) { try { setWorkingOn(job); job.perform(); } catch (Exception e) { if (e.InnerException != null) { job.fail(e.InnerException); } else { job.fail(e); } setFailed(); } finally { if (block != null) { block(job); } setDoneWorking(job); } }