Skip to content
Snippets Groups Projects
Commit e2eef359 authored by Nico Vermaas's avatar Nico Vermaas
Browse files

Merge branch 'SDC-1235-bug-services-on-hold' into 'master'

bugfix SDC-1235

See merge request !345
parents 52d732f3 db50cf92
No related branches found
No related tags found
1 merge request!345bugfix SDC-1235
Pipeline #73676 passed
......@@ -2,6 +2,7 @@ from django.db import models
from django.urls import reverse
from django.utils import timezone
from django.utils.timezone import datetime, timedelta
from django.core.exceptions import MultipleObjectsReturned
from django.conf import settings
import json
import logging
......@@ -609,11 +610,20 @@ class Monitor(models.Model):
# in the LatestMonitor, and update if it is newer.
try:
latestMonitor = LatestMonitor.objects.get(name=self.name,hostname=self.hostname)
except MultipleObjectsReturned as e:
# it has happened that latest_monitoring objects failed to delete,
# which leads to a growing database and failure of the 'Hold' button on the Monitoring screen.
LatestMonitor.objects.all().delete()
try:
# carry over the metadata, if possible
latest_metadata = latestMonitor.metadata
latestMonitor.delete()
except:
pass
except Exception as error:
print(error)
# this combination of name and hostname didn't yet exist, create it.
metadata = self.metadata
......
......@@ -31,7 +31,7 @@
{% include 'taskdatabase/pagination.html' %}
</div>
</div>
<p class="footer"> Version 22 Feb 2024
<p class="footer"> Version 23 Feb 2024
</div>
{% include 'taskdatabase/refresh.html' %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment