Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporarily disallow updates to PKs which already have results #515

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion tr_sys/tr_ars/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down