From 724213a624ac86d81b284e0c815e927767c928cf Mon Sep 17 00:00:00 2001 From: Williams Date: Thu, 12 Oct 2023 10:35:51 -0400 Subject: [PATCH] Adding temporary condition to disallow updates to PKs which already have results --- tr_sys/tr_ars/api.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tr_sys/tr_ars/api.py b/tr_sys/tr_ars/api.py index a22d2259..e74f2ca3 100644 --- a/tr_sys/tr_ars/api.py +++ b/tr_sys/tr_ars/api.py @@ -412,12 +412,15 @@ def message(req, key): code = 200 if 'tr_ars.message.status' in req.headers: status = req.headers['tr_ars.message.status'] - res=utils.get_safe(data,"message","results") kg = utils.get_safe(data,"message", "knowledge_graph") actor = Actor.objects.get(pk=mesg.actor_id) inforesid =actor.inforesid logging.info('received msg from agent: %s with parent pk: %s' % (str(inforesid), str(mesg.ref_id))) + if mesg.result_count is not None and mesg.result_count >0: + return HttpResponse('ARS already has a response with: %s results for pk %s \nWe are temporarily ' + 'disallowing subsequent updates to PKs which already have results\n' + % (str(len(res)), str(key)),status=409) if mesg.status=='E': return HttpResponse("Response received but Message is already in state "+str(mesg.code)+". Response rejected\n",status=400) if res is not None and len(res)>0: