2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-25 08:41:51 +00:00

trying to debug crashing db

This commit is contained in:
Philip Sargent 2024-02-05 21:18:40 +00:00
parent 1e00e56522
commit c72efe1326

View File

@ -717,9 +717,11 @@ def GetCaveLookup():
Gcave_count.pop(d) # so should not get a duplicate msg below..
ldup.append(d)
if ldup:
message = f" - Ambiguous aliases removed: {ldup}"
message = f" - Ambiguous aliases being removed: {ldup}"
print(message)
DataIssue.objects.update_or_create(parser="aliases ok", message=message)
update_dataissue("aliases ok", message)
DataIssue.objects.update_or_create(parser="aliases ok", message=message)
for c in Gcave_count:
if Gcave_count[c] > 1:
@ -728,3 +730,19 @@ def GetCaveLookup():
DataIssue.objects.update_or_create(parser="aliases", message=message)
return Gcavelookup
def update_dataissue(parsercode, message):
try:
DataIssue.objects.update_or_create(parser=parsercode, message=message)
except:
# Complete bollocks, but MariaDB barfs when it shouldn't : Django 3.2
issues = DataIssue.objects.filter(parser=parsercode, message=message)
print(f" # EXCEPTION looking for DataIssue '{parsercode}' {message})")
if len(issues) > 1:
print(f" # MULTIPLE DataIssues '{parsercode}' {message}")
for s in issues:
print(f" # {s.id=} DataIssues '{parsercode}' {message}") # .id is Django internal field, not one of ours
message = "#2 " + message
issue[0].message = message
issue[0].save()