func checkWorkingJob(task *jobqueue.Task, agent *lochness.MistifyAgent) (bool, error) { done, err := agent.CheckJobStatus(task.Job.Action, task.Guest.ID, task.Job.RemoteID) if err == nil && done && task.Job.Action == "fetch" { task.Job.Action = "create" task.Job.RemoteID = "" task.Job.Status = jobqueue.JobStatusNew done = false // Save Job Status if err := task.Job.Save(24 * time.Hour); err != nil { log.WithFields(log.Fields{ "task": task, "error": err, }).Error("unable to save") return done, err } } return done, err }