Commit 7f30471e authored by janis.streib's avatar janis.streib 🦉
Browse files

FIX: serialize to and from redis

parent 3aa191e1
......@@ -61,7 +61,7 @@ def create_job():
created_jobs.append(job_id)
pipe = r.pipeline()
pipe.multi()
pipe.set(job_id, MacFinderJob(mac=request.json['mac'], job_id=job_id, vlan=vlan, bcd=vlan.bcd))
pipe.set(job_id, jsonify(MacFinderJob(mac=request.json['mac'], job_id=job_id, vlan=vlan, bcd=vlan.bcd)))
pipe.expire(job_id, 60 * 60 * 12)
pipe.execute()
return jsonify({'success': True, 'job_ids': created_jobs})
......@@ -71,7 +71,7 @@ def create_job():
@api_netdb_required
def poll(job_id):
with redis.Redis(db=int(app.config.get('REDIS_DB_INDEX'))) as r:
job = r.get(job_id)
job = MacFinderJob(**json.loads(r.get(job_id)))
session = requests.session()
job.poll(session, db, get_db_conn())
pipe = r.pipeline()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment